HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Friends
v1::font_metrics Struct Reference

#include <hikogui/font/font_metrics.hpp>

Public Member Functions

constexpr font_metrics (font_metrics const &) noexcept=default
 
constexpr font_metrics (font_metrics &&) noexcept=default
 
constexpr font_metricsoperator= (font_metrics const &) noexcept=default
 
constexpr font_metricsoperator= (font_metrics &&) noexcept=default
 
float round_scale (float size) const noexcept
 Round a scale so that the scaled x-height is an integral.
 

Data Fields

float ascender = 0.0f
 Distance from baseline of highest ascender.
 
float descender = 0.0f
 Distance from baseline of lowest descender.
 
float line_gap = 0.0f
 Distance between lines.
 
float cap_height = 0.0f
 Height of capital letter, or height of the letter 'H'.
 
float x_height = 0.0f
 Height of lower case characters without ascenders or descenders, or the small letter 'x'.
 
float digit_advance = 0.0f
 The advance for digits, specifically the digit '8'.
 
float line_spacing = 1.0f
 The multiplier for the space between lines of the same paragraph.
 
float paragraph_spacing = 1.5f
 The multiplier for the space between two paragraphs.
 

Friends

constexpr friend bool operator== (font_metrics const &, font_metrics const &) noexcept=default
 
constexpr friend font_metrics operator* (float const &lhs, font_metrics const &rhs) noexcept
 Scale the metrics by a scalar value.
 
constexpr friend font_metrics max (font_metrics const &a, font_metrics const &b) noexcept
 

Detailed Description

The metrics of a font.

These are the metrics that are used for the font as a whole. Inside the font these are in 'em' units, outside the font they may have been scaled to 'points' or 'dp'.

Member Function Documentation

◆ round_scale()

float v1::font_metrics::round_scale ( float size) const
inlinenoexcept

Round a scale so that the scaled x-height is an integral.

Friends And Related Symbol Documentation

◆ operator*

Scale the metrics by a scalar value.

Field Documentation

◆ ascender

float v1::font_metrics::ascender = 0.0f

Distance from baseline of highest ascender.

◆ cap_height

float v1::font_metrics::cap_height = 0.0f

Height of capital letter, or height of the letter 'H'.

◆ descender

float v1::font_metrics::descender = 0.0f

Distance from baseline of lowest descender.

Note
positive downward.

◆ digit_advance

float v1::font_metrics::digit_advance = 0.0f

The advance for digits, specifically the digit '8'.

Note
: All digits in a font should have the same advance.

◆ line_gap

float v1::font_metrics::line_gap = 0.0f

Distance between lines.

The distance between the descender of a line and the ascender of the next line.

◆ line_spacing

float v1::font_metrics::line_spacing = 1.0f

The multiplier for the space between lines of the same paragraph.

Note
This is not an actual font property, but comes from the text-style.

◆ paragraph_spacing

float v1::font_metrics::paragraph_spacing = 1.5f

The multiplier for the space between two paragraphs.

Note
This is not an actual font property, but comes from the text-style.

◆ x_height

float v1::font_metrics::x_height = 0.0f

Height of lower case characters without ascenders or descenders, or the small letter 'x'.


The documentation for this struct was generated from the following file: