class

Egui::Backend::CrystalFonts

Inherits Egui::Backend::AtlasFonts < Egui::Fonts < Reference < Object

Constants

STRIDE = 4194304

Composite gid packing: gid = face_index * STRIDE + local_gid. Local gids never exceed the glyph count of a sane font (< 2^20 even for the huge CJK faces); four faces still fit an Int32.

Constructors

new(font_datas : Array(String), atlas : GlyphAtlas | Nil = nil)
Source

Class methods

from_system(paths : Array(String), atlas : GlyphAtlas | Nil = nil) : CrystalFonts | Nil

Every loadable path becomes one face of the chain (primary first); nil only when nothing parsed. Unparseable files are skipped — a mixed list (TTF + a CFF the port can't read) keeps the faces that work.

Source

Instance methods

build_glyph(gid : Int32, size : Float64) : Glyph
Source
face_paths

Source path per face (diagnostics; empty for direct new calls).

Source
glyph_index(codepoint : Int32) : Int32

The chain scan: the first face with a glyph for codepoint wins (composite gid); 0 = missing everywhere (notdef, like the single-font backends).

Source
kern_px(prev_gid : Int32, gid : Int32, size : Float64) : Float64

FT_Get_Kerning(FT_KERNING_DEFAULT): font units -> FT_MulFix by the size's x_scale, scaled down through MulDiv when ppem < 25, then rounded to whole pixels. Only pairs from the SAME face kern — cross-face pairs (a symbol after a letter) take zero.

Source
loaded?
Source
metrics_at(size : Float64) : Tuple(Float64, Float64)

{ascender, descender} in px (descender negative) of the PRIMARY face, cached per size — computed linearly from the font units exactly like FreetypeFonts.

Source