std :: gui::gui_text
Struct std::GuiTypeface
struct GuiTypeface {
const ?&unsigned char data;
unsigned long size;
int owned;
int faceIndex;
unsigned int tHead;
unsigned int tHhea;
unsigned int tHmtx;
unsigned int tMaxp;
unsigned int tCmap;
unsigned int tLoca;
unsigned int tGlyf;
unsigned int tKern;
unsigned int tGpos;
unsigned int tOs2;
unsigned int tName;
unsigned int lenGlyf;
unsigned int lenLoca;
int numGlyphs;
int unitsPerEm;
int indexToLocFormat;
int numHMetrics;
int ascender;
int descender;
int lineGap;
int capHeight;
int xHeight;
int weight;
int italic;
int hasOutlines;
unsigned int cmapSub;
int cmapFormat;
unsigned int kernSub;
int kernPairs;
struct Vec<unsigned int> gposPairs;
struct String family;
struct Vec<struct GuiGlyphBitmap> cache;
struct Vec<int> cacheIndex;
}Fields
the font file
data was copied/read by us: free() releases it
within a TrueType collection (.ttc)
table offsets from the start of 'data' (0 = absent)
table offsets from the start of 'data' (0 = absent)
table offsets from the start of 'data' (0 = absent)
table offsets from the start of 'data' (0 = absent)
font units, positive up
font units, negative (below the baseline)
OS/2 usWeightClass (400 regular, 700 bold)
0 for a CFF font loaded with GUI_FONT_ALLOW_NO_OUTLINES
chosen cmap subtable (offset from data)
'kern' format 0 subtable: pairs at kernSub+14
GPOS PairPos subtables (offsets from data)
name table family name (UTF-8), may be empty
glyph cache (see GuiCanvas::fill_text): entries + open-addressed index
Methods
Parse a font in place ('struct GuiTypeface f; f.load_file(...)'). Return 1, or 0 for a missing/malformed/unsupported file (the face is then empty: free() is still fine). A .ttc collection loads its face 'index' with load_memory_index / load_file_index.
'flags': GUI_FONT_COPY to keep a copy (otherwise 'bytes' must outlive the face), GUI_FONT_ALLOW_NO_OUTLINES.
The built-in fallback face (process lifetime; never free it).
A system font: "sans" / "serif" / "mono" or a family name such as "DejaVu Sans", "Helvetica", "Segoe UI", searched in the system font directories (and $SAFEC_GUI_FONT_DIR). Faces are loaded once and kept for the process; null when nothing matches.
Like system(), but a bold variant when the family has one.
The glyph for codepoint 'cp' (0 = .notdef: not in this font).
In pixels at 'size' px.
above the baseline, positive
below the baseline, positive
ascent + descent + line gap
Appends glyph's outline to 'out', scaled to 'size' px with the pen (baseline origin) at (x, y), y down. Returns 0 for an empty glyph (a space) or one that can't be read.
Glyph bounding box in font units (y up); 0 if it has none.
Width in pixels of one line of UTF-8 text at 'size' (kerning applied, glyphs this face lacks measured from the fallback face).
Takes ownership of 'b.coverage'. Returns the stored entry.
= drop()