CArcFont
- Module
- Arc
- Header
#include "Arc/Text/CArcFont.h"- Namespace
Arcf
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | STEM_DARKEN_FULL_PX | Stem darkening for small text, the way browsers and macOS render it: an unhinted outline is widened by this fraction of the em at small device sizes, fading to nothing between STEM_DARKEN_FULL_PX and STEM_DARKEN_NONE_PX, where the stems are wide enough on their own. The advances are untouched, so layout does not move. Default 14.0f. |
static constexpr float | STEM_DARKEN_NONE_PX | Default 24.0f. |
Constructors
Public functions
| Returns | Name | Description |
|---|---|---|
bool | LoadFromFile | |
bool | LoadFromMemory | |
CArcFont* | FromFace | The CArcFont that owns a FreeType face, or null. |
bool | IsColorFont | A face that paints its own colours (COLR, CBDT or sbix): an emoji face. |
void | SetHinting | |
EArcFontHinting | GetHinting | |
void | SetSyntheticEmbolden | Synthetic weight for a weight the family does not ship (Geist Medium): the outline is widened by this fraction of the em before rasterizing. |
float | GetSyntheticEmbolden | |
void | SetStemDarkening | |
float | GetStemDarkening | |
float | StemDarkeningFade | |
void | SetSyntheticOblique | Synthetic italic for a family with no italic face: x += skew * y. |
float | GetSyntheticOblique | |
void | SetAbsoluteStroke | A stroke-built icon font drawn at a fixed stroke whatever its size (Lucide's absoluteStrokeWidth): designStrokeEm is the stroke the outlines carry as a fraction of the em, strokePx the logical stroke wanted. |
void | SetPlainCoverage | Glyphs that stand for drawings rather than letters (Lucide): the design export draws them as SVG paths, which the browser blends with plain coverage, not through its text gamma. |
bool | HasPlainCoverage | |
float | OutlineDeltaPixels | Device pixels to widen (or thin) every stroke by at a device pixel size on a raster grid: synthetic weight plus the absolute-stroke correction. |
FT_Face | GetFace | |
const std::string& | GetFamilyName | |
const std::string& | GetStyleName | |
uint32_t | GetGlyphIndex | FreeType char->glyph lookup, cached (fallback-chain probing is hot) |
void | GetVerticalMetrics | Whole device pixels above and below the baseline at a pixel size: the OS/2 win metrics when the face has them (they bound every glyph the font draws, accented capitals and stacked marks included), else hhea. |
bool | GetInkBounds | The outline's ink of one glyph in em units, y up from the baseline: what a centred icon is centred on. |
float | GetCapHeightEm | Capital height in em units (OS/2 sCapHeight, else the ink of 'H'): the band a centred label is centred on, so a descender does not pull it up and the line box's descent does not push it down. |
float | GetOpticalCentreEm | The height above the baseline, in em, that sits in the middle of a line box: half the capital height for a text face, the middle of the face's bounding box for a symbol face (one with neither a cap height nor an 'H'), whose glyphs carry no capitals to centre. |
bool | IsSymbolFace | |
void | AddFallback | |
const std::vector<Ref<CArcFont>>& | GetFallbacks |
Function details
CArcFont
CArcFont() = default~CArcFont
~CArcFont() overrideLoadFromFile
bool LoadFromFile(const std::string& path)LoadFromMemory
bool LoadFromMemory(const uint8_t* data, size_t size)FromFace
static CArcFont* FromFace(FT_Face face)The CArcFont that owns a FreeType face, or null. The atlas works on faces, and reads the per-font render settings below through this.
IsColorFont
bool IsColorFont() constA face that paints its own colours (COLR, CBDT or sbix): an emoji face.
SetHinting
void SetHinting(EArcFontHinting hinting)GetHinting
EArcFontHinting GetHinting() constSetSyntheticEmbolden
void SetSyntheticEmbolden(float emFraction)Synthetic weight for a weight the family does not ship (Geist Medium): the outline is widened by this fraction of the em before rasterizing.
GetSyntheticEmbolden
float GetSyntheticEmbolden() constSetStemDarkening
void SetStemDarkening(float emFraction)GetStemDarkening
float GetStemDarkening() constStemDarkeningFade
static float StemDarkeningFade(float devicePixelSize)SetSyntheticOblique
void SetSyntheticOblique(float skew)Synthetic italic for a family with no italic face: x += skew * y. 0.2 is about 11 degrees, the slant most sans italics use.
GetSyntheticOblique
float GetSyntheticOblique() constSetAbsoluteStroke
void SetAbsoluteStroke(float strokePx, float designStrokeEm)A stroke-built icon font drawn at a fixed stroke whatever its size (Lucide's absoluteStrokeWidth): designStrokeEm is the stroke the outlines carry as a fraction of the em, strokePx the logical stroke wanted. Lucide is 2/24 of the em, so at 12 px it is 1 px, at 16 px 1.33 px; the design draws 1.5 px at every size.
SetPlainCoverage
void SetPlainCoverage(bool plain)Glyphs that stand for drawings rather than letters (Lucide): the design export draws them as SVG paths, which the browser blends with plain coverage, not through its text gamma. Their quads skip CArcTextContrast; shaped like text, light icons read heavy and dark ones thin.
HasPlainCoverage
bool HasPlainCoverage() constOutlineDeltaPixels
float OutlineDeltaPixels(float devicePixelSize, float rasterScale) constDevice pixels to widen (or thin) every stroke by at a device pixel size on a raster grid: synthetic weight plus the absolute-stroke correction. 0 when the font asks for neither.
GetFace
FT_Face GetFace() constGetFamilyName
const std::string& GetFamilyName() constGetStyleName
const std::string& GetStyleName() constGetGlyphIndex
uint32_t GetGlyphIndex(uint32_t codepoint) constFreeType char->glyph lookup, cached (fallback-chain probing is hot)
GetVerticalMetrics
void GetVerticalMetrics(uint32_t pixelSize, int32_t& outAscent, int32_t& outDescent) constWhole device pixels above and below the baseline at a pixel size: the OS/2 win metrics when the face has them (they bound every glyph the font draws, accented capitals and stacked marks included), else hhea. Rounded outwards, so ink never leaves the box they describe.
GetInkBounds
bool GetInkBounds(uint32_t codepoint, float& outXMin, float& outYMin, float& outXMax, float& outYMax) constThe outline's ink of one glyph in em units, y up from the baseline: what a centred icon is centred on. False for a glyph the face lacks.
GetCapHeightEm
float GetCapHeightEm() constCapital height in em units (OS/2 sCapHeight, else the ink of 'H'): the band a centred label is centred on, so a descender does not pull it up and the line box's descent does not push it down.
GetOpticalCentreEm
float GetOpticalCentreEm() constThe height above the baseline, in em, that sits in the middle of a line box: half the capital height for a text face, the middle of the face's bounding box for a symbol face (one with neither a cap height nor an 'H'), whose glyphs carry no capitals to centre.
IsSymbolFace
bool IsSymbolFace() constAddFallback
void AddFallback(const Ref<CArcFont>& font)GetFallbacks
const std::vector<Ref<CArcFont>>& GetFallbacks() const