7#include "../macros.hpp"
11hi_export_module(hikogui.font.font_metrics);
24 float ascender = 0.0f;
30 float descender = 0.0f;
36 float line_gap = 0.0f;
40 float cap_height = 0.0f;
44 float x_height = 0.0f;
50 float digit_advance = 0.0f;
55 float line_spacing = 1.0f;
60 float paragraph_spacing = 1.5f;
100 return std::round(x_height * size) / x_height;
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
The metrics of a font.
Definition font_metrics.hpp:21
float descender
Distance from baseline of lowest descender.
Definition font_metrics.hpp:30
float line_gap
Distance between lines.
Definition font_metrics.hpp:36
float ascender
Distance from baseline of highest ascender.
Definition font_metrics.hpp:24
float round_scale(float size) const noexcept
Round a scale so that the scaled x-height is an integral.
Definition font_metrics.hpp:98
float x_height
Height of lower case characters without ascenders or descenders, or the small letter 'x'.
Definition font_metrics.hpp:44
float cap_height
Height of capital letter, or height of the letter 'H'.
Definition font_metrics.hpp:40
float digit_advance
The advance for digits, specifically the digit '8'.
Definition font_metrics.hpp:50