scimesh 0.3.4
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::FontMetrics Struct Reference

Vertical metrics of a font at a given pixel size. More...

#include <font.h>

Public Member Functions

float line_height () const
 Total height of one line, in pixels (ascent + descent + line_gap).
 
float box_height () const
 Height of the glyph box of one line, in pixels (ascent + descent).
 

Public Attributes

float ascent = 0.0f
 Distance from the baseline to the top of the line, in pixels.
 
float descent = 0.0f
 Distance from the baseline to the bottom of the line, in pixels.
 
float line_gap = 0.0f
 Recommended extra spacing between two lines, in pixels.
 

Detailed Description

Vertical metrics of a font at a given pixel size.

All values are distances in output pixels. They describe a single line of text: the baseline sits at some pixel row, ascent pixels above it is the top of the tallest glyph, descent pixels below it is the lowest point of the line (positive value), and line_gap is the recommended additional spacing between two lines.

See also
Font::metrics()

Definition at line 59 of file font.h.

Member Function Documentation

◆ box_height()

float scimesh::FontMetrics::box_height ( ) const
inline

Height of the glyph box of one line, in pixels (ascent + descent).

Definition at line 75 of file font.h.

◆ line_height()

float scimesh::FontMetrics::line_height ( ) const
inline

Total height of one line, in pixels (ascent + descent + line_gap).

Definition at line 72 of file font.h.

Member Data Documentation

◆ ascent

float scimesh::FontMetrics::ascent = 0.0f

Distance from the baseline to the top of the line, in pixels.

Definition at line 61 of file font.h.

◆ descent

float scimesh::FontMetrics::descent = 0.0f

Distance from the baseline to the bottom of the line, in pixels.

Stored as a positive value (the raw TrueType descent is negative).

Definition at line 66 of file font.h.

◆ line_gap

float scimesh::FontMetrics::line_gap = 0.0f

Recommended extra spacing between two lines, in pixels.

Definition at line 69 of file font.h.


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