![]() |
Lysa
0.0
Lysa 3D Engine
|
Font resource used to render text.
A font is defined by a font file and a size. Glyphs are packed into an atlas and common metrics (ascender, descender, line height) are exposed for text layout.
Inheritance diagram for Font:Classes | |
| struct | GlyphBounds |
| struct | GlyphInfo |
Public Member Functions | |
| Font (const std::string &path) | |
| Font (const Font &font) | |
| ~Font () override | |
| std::shared_ptr< Font > | clone () |
| void | getSize (const std::string &text, float fontScale, float &width, float &height) |
| float2 | getSize (const std::string &text, float fontScale) |
| float | getWidth (char c, float fontScale) |
| uint32 | getFontSize () const |
| float | getLineHeight () const |
| float | getAscender () const |
| float | getDescender () const |
| const GlyphInfo & | getGlyphInfo (uint32 index) const |
| const Image & | getAtlas () const |
| const FontParams & | getFontParams () const |
| float2 | getPxRange () const |
| float4 | getOutlineColor () const |
| float | getOutlineThreshold () const |
| float | getOutlineBias () const |
| float | getOutlineWidthAbsolute () const |
| float | getOutlineWidthRelative () const |
| float | getRoundedOutline () const |
| float | getRoundedInterior () const |
| float | getOutlineBlur () const |
| void | setPxRange (const float2 &range) |
| void | setOutlineColor (const float4 &color) |
| void | setOutlineBias (float bias) |
| void | setOutlineWidthAbsolute (float width) |
| void | setOutlineWidthRelative (float width) |
| void | setOutlineBlur (float blur) |
| void | setOutlineThreshold (float threshold) |
| void | setRoundedOutline (float roundedOutline) |
| void | setRoundedInterior (float roundedInterior) |
| auto | getHarfBuzzFont () const |
| void | setDirty () |
| bool | isDirty () const |
| void | decrementDirty () |
Public Member Functions inherited from UnmanagedResource | |
| UnmanagedResource () | |
| UnmanagedResource (const Resource &other) | |
Public Member Functions inherited from Resource | |
| bool | operator== (const Resource &other) const |
| Resource () = default | |
| Resource (const unique_id id) | |
| virtual | ~Resource () = default |
Additional Inherited Members | |
Public Attributes inherited from Resource | |
| unique_id | id {INVALID_ID} |
| Font | ( | const std::string & | path | ) |
Construct a font resource from a font file.
| path | Font file path, relative to the application working directory. |
| Font | ( | const Font & | font | ) |
|
override |
| std::shared_ptr<Font> clone | ( | ) |
|
inline |
|
inline |
Ascender in pixels (above the baseline).
|
inline |
Get the underlying glyph atlas image.
|
inline |
Descender in pixels (below the baseline).
|
inline |
Get current font rendering parameters.
|
inline |
Get the font size used to build the atlas (in pixels).
Retrieve glyph information by glyph index.
| index | Glyph index as returned by the shaper. |
|
inline |
Access the underlying HarfBuzz font handle.
|
inline |
Line height relative to the font size.
|
inline |
Get the outline bias.
|
inline |
Get the outline blur factor.
|
inline |
Get the outline color (RGBA).
|
inline |
Get the SDF/MSDF threshold.
|
inline |
Get the absolute outline width (in pixels).
|
inline |
Get the relative outline width (scaled by font size).
|
inline |
Get the SDF/MSDF pixel range (x = lower, y = upper).
|
inline |
|
inline |
| float2 getSize | ( | const std::string & | text, |
| float | fontScale | ||
| ) |
Compute the size in pixels for a UTF-8 string.
| text | Input text. |
| fontScale | Scale factor applied to the base font size (1.0 = atlas size). |
| void getSize | ( | const std::string & | text, |
| float | fontScale, | ||
| float & | width, | ||
| float & | height | ||
| ) |
Compute the size in pixels for a UTF-8 string.
| text | Input text. |
| fontScale | Scale factor applied to the base font size (1.0 = atlas size). |
| width | Output total width in pixels. |
| height | Output total height in pixels. |
| float getWidth | ( | char | c, |
| float | fontScale | ||
| ) |
|
inline |
| void setDirty | ( | ) |
| void setOutlineBias | ( | float | bias | ) |
Set the outline bias.
| void setOutlineBlur | ( | float | blur | ) |
Set the outline blur factor.
| void setOutlineColor | ( | const float4 & | color | ) |
Set the outline color.
| void setOutlineThreshold | ( | float | threshold | ) |
Set the SDF/MSDF threshold.
| void setOutlineWidthAbsolute | ( | float | width | ) |
Set the absolute outline width (in pixels).
| void setOutlineWidthRelative | ( | float | width | ) |
Set the relative outline width (scaled by font size).
| void setPxRange | ( | const float2 & | range | ) |
Set the SDF/MSDF pixel range (x = lower, y = upper).
| void setRoundedInterior | ( | float | roundedInterior | ) |
| void setRoundedOutline | ( | float | roundedOutline | ) |