HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
v1::font_metrics< Unit, T > Struct Template 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_metrics & operator= (font_metrics const &) noexcept=default
constexpr font_metrics & operator= (font_metrics &&) noexcept=default

Data Fields

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

Friends

constexpr friend bool operator== (font_metrics const &, font_metrics const &) noexcept=default
template<typename LhsUnit, typename LhsT>
requires std::same_as<Unit, unit::EmSquares>
constexpr friend auto operator* (au::Quantity< LhsUnit, LhsT > 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

template<typename Unit, typename T>
struct v1::font_metrics< Unit, T >

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'.

◆ operator*

template<typename Unit, typename T>
template<typename LhsUnit, typename LhsT>
requires std::same_as<Unit, unit::EmSquares>
friend auto operator* ( au::Quantity< LhsUnit, LhsT > const & lhs,
font_metrics< Unit, T > const & rhs )
friend

Scale the metrics by a scalar value.

Field Documentation

◆ ascender

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::ascender

Distance from baseline of highest ascender.

◆ cap_height

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::cap_height

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

◆ descender

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::descender

Distance from baseline of lowest descender.

Note
positive downward.

◆ digit_advance

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::digit_advance

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

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

◆ line_gap

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::line_gap

Distance between lines.

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

◆ line_spacing

template<typename Unit, typename T>
float v1::font_metrics< Unit, T >::line_spacing = 0.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

template<typename Unit, typename T>
float v1::font_metrics< Unit, T >::paragraph_spacing = 0.0f

The multiplier for the space between two paragraphs.

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

◆ x_height

template<typename Unit, typename T>
au::Quantity<Unit, T> v1::font_metrics< Unit, T >::x_height

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: