CArcFontManager
- Module
- Arc
- Header
#include "Arc/Text/CArcFont.h"- Namespace
Arcf
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | ICON_STROKE_PX | The design's icon rendering (Lucide at 12/14/16 px with an absolute 1.5 px stroke, unhinted). One definition, used by the bridge and by the row that measures the strokes. Default 1.5f. |
static constexpr float | LUCIDE_DESIGN_STROKE_EM | Default 2.0f / 24.0f. |
static constexpr float | TEXT_STEM_DARKEN_EM | The design's text rendering, matched to the export's browser captures: unhinted outlines (advances and stems at their true fractional positions) with TEXT_STEM_DARKEN_EM of stem darkening below 14 device px, then the browser's luminance blend (CArcTextContrast). Fitted pixel by pixel to the menu bar of all three themes' references: 0.025 em with the old contrast curve put 1.23x the reference's ink into the light theme; 0.01 em with the gamma blend lands every theme within 2 %. Default 0.01f. |
Public functions
| Returns | Name | Description |
|---|---|---|
CArcFontManager& | Get | |
bool | Initialize | |
void | Shutdown | |
void | RegisterFamily | |
CArcFont* | GetFont | |
void | AddFallbackFont | Composite-font fallback chain: fonts probed in order when the primary face has no glyph for a codepoint (CJK, emoji, symbols). |
void | ClearFallbackFonts | |
const std::vector<Ref<CArcFont>>& | GetFallbackFonts | |
CArcFont* | ResolveFontForCodepoint | Resolve the face that carries a codepoint: primary, then the fallback chain. |
CArcFont* | ResolveFontForCluster | Resolve the face for a whole grapheme cluster, so every codepoint of it shapes in one run: a ZWJ family, a keycap, a flag or a letter with its marks. |
void | SetTextLanguage | The language of the text being laid out (BCP 47: "en", "zh-CN", "sr-Cyrl"). |
const std::string& | GetTextLanguage | |
float | GetKerning | Kerning between two glyph indices of the same face at a pixel size, cached. |
void | SetTextRasterScale | The device-pixel grid text is currently laid out for. |
float | GetTextRasterScale | |
float | DeviceFontSize | The integer FreeType pixel size a logical size maps to on that grid. |
float | QuantizeToDeviceGrid | Rounds a logical measurement onto whole device pixels. |
void | AdvanceAtlasFrame | Frame boundary for every atlas (see CArcFontAtlas::AdvanceFrame). |
void | ConfigureIconFont | |
void | ConfigureTextFont | |
CArcFontAtlas& | GetSDFAtlas | |
CArcFontAtlas& | GetBitmapAtlas | |
CArcFontAtlas& | GetTextAtlas | The atlas the ordinary text path paints from: the bitmap atlas. |
CArcFontAtlas* | GetColorAtlas | The text atlas's colour companion (emoji), or null before Initialize. |
FT_Library | GetFTLibrary |
Function details
Get
static CArcFontManager& Get()Initialize
bool Initialize(IArcRHIDevice* device)Shutdown
void Shutdown()RegisterFamily
void RegisterFamily(const CArcFontFamily& family)GetFont
CArcFont* GetFont(const std::string& family, bool bold = false, bool italic = false) constAddFallbackFont
void AddFallbackFont(const Ref<CArcFont>& font, const std::string& language = std::string())Composite-font fallback chain: fonts probed in order when the primary face has no glyph for a codepoint (CJK, emoji, symbols). language tags the face for the Han characters several CJK languages share ("zh-Hans", "zh-Hant", "ja", "ko"): with the text language set to one of them, its face is tried first for Han, so Simplified Chinese stops being drawn with Japanese glyph forms.
ClearFallbackFonts
void ClearFallbackFonts()GetFallbackFonts
const std::vector<Ref<CArcFont>>& GetFallbackFonts() constResolveFontForCodepoint
CArcFont* ResolveFontForCodepoint(CArcFont* primary, uint32_t codepoint) constResolve the face that carries a codepoint: primary, then the fallback chain. Returns nullptr when no registered face has it (tofu).
ResolveFontForCluster
CArcFont* ResolveFontForCluster(CArcFont* primary, const uint32_t* codepoints, size_t count) constResolve the face for a whole grapheme cluster, so every codepoint of it shapes in one run: a ZWJ family, a keycap, a flag or a letter with its marks. Picking per codepoint split "family" into three emoji and a ZWJ from a text face that never ligated. Emoji presentation (VS16, ZWJ, regional indicators, keycaps, pictographs) tries colour faces first; Han tries the text language's tagged face first; then the first face covering every non-ignorable codepoint; then the base.
SetTextLanguage
void SetTextLanguage(const std::string& language)The language of the text being laid out (BCP 47: "en", "zh-CN", "sr-Cyrl"). Picks the Han face, and tells HarfBuzz which localized forms to use (Serbian Cyrillic, Turkish i, Romanian s-comma). The localization manager's culture switch sets it. Changing it drops every cached layout.
GetTextLanguage
const std::string& GetTextLanguage() constGetKerning
float GetKerning(CArcFont* font, float fontSize, float rasterScale, uint32_t leftGlyphIndex, uint32_t rightGlyphIndex)Kerning between two glyph indices of the same face at a pixel size, cached. Legacy (arc.Shaping=0) path only — returns 0 for faces without a kern table; the shaped path gets GPOS kerning from HarfBuzz instead.
SetTextRasterScale
void SetTextRasterScale(float scale)The device-pixel grid text is currently laid out for. The renderer publishes its window's pixel density here before arranging and painting, so shaping, kerning and rasterization all describe the same outlines: advances hinted at the logical size land off the device grid on any fractional scale, and the glyph bitmaps they position were hinted at the device size. Layouts are cached per value, so a second window on a differently scaled monitor keeps its own set instead of thrashing this one.
GetTextRasterScale
float GetTextRasterScale() constDeviceFontSize
static float DeviceFontSize(float logicalSize, float rasterScale)The integer FreeType pixel size a logical size maps to on that grid.
QuantizeToDeviceGrid
static float QuantizeToDeviceGrid(float logicalValue, float rasterScale)Rounds a logical measurement onto whole device pixels.
AdvanceAtlasFrame
void AdvanceAtlasFrame()Frame boundary for every atlas (see CArcFontAtlas::AdvanceFrame).
ConfigureIconFont
static void ConfigureIconFont(CArcFont& font)ConfigureTextFont
static void ConfigureTextFont(CArcFont& font, float stemDarkeningEm = TEXT_STEM_DARKEN_EM)GetSDFAtlas
CArcFontAtlas& GetSDFAtlas()GetBitmapAtlas
CArcFontAtlas& GetBitmapAtlas()GetTextAtlas
CArcFontAtlas& GetTextAtlas()The atlas the ordinary text path paints from: the bitmap atlas. The multi-channel distance-field path was removed — it read worse at the 10-13 px sizes the UI actually uses.
GetColorAtlas
CArcFontAtlas* GetColorAtlas()The text atlas's colour companion (emoji), or null before Initialize.
GetFTLibrary
FT_Library GetFTLibrary() const