7#include "otype_utilities.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
13hi_export_module(hikogui.font.otype_hhea);
15hi_export
namespace hi {
inline namespace v1 {
17[[nodiscard]]
inline auto otype_hhea_parse(std::span<std::byte const> bytes,
float em_scale)
20 big_int16_buf_t major_version;
21 big_int16_buf_t minor_version;
22 otype_fword_buf_t ascender;
23 otype_fword_buf_t descender;
24 otype_fword_buf_t line_gap;
25 otype_fuword_buf_t advance_width_max;
26 otype_fword_buf_t min_left_side_bearing;
27 otype_fword_buf_t min_right_side_bearing;
28 otype_fword_buf_t x_max_extent;
29 big_int16_buf_t caret_slope_rise;
30 big_int16_buf_t caret_slop_run;
31 big_int16_buf_t caret_offset;
32 big_int16_buf_t reserved_0;
33 big_int16_buf_t reserved_1;
34 big_int16_buf_t reserved_2;
35 big_int16_buf_t reserved_3;
36 big_int16_buf_t metric_data_format;
37 big_uint16_buf_t number_of_h_metrics;
44 uint16_t number_of_h_metrics;
47 auto const& header = implicit_cast<header_type>(bytes);
48 hi_check(*header.major_version == 1 && *header.minor_version == 0,
"'hhea' version is not 1.0");
50 auto r = return_type{};
51 r.ascender = header.ascender * em_scale;
52 r.descender = header.descender * em_scale;
53 r.line_gap = header.line_gap * em_scale;
54 r.number_of_h_metrics = *header.number_of_h_metrics;
56 hi_check(r.ascender > 0.0f,
"'hhea' ascender must be larger than 0.0");
57 hi_check(r.descender <= 0.0f,
"'hhea' descender must be less than or equal to 0.0");
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20