//----------------------------------------------------------------------------- // Get the list of available font filenames, and load the name for each of // them. Only that, though, not the glyphs too. //----------------------------------------------------------------------------- void TtfFontList::LoadAll(void) { if(loaded) return; // Get the list of font files from the platform-specific code. LoadAllFontFiles(); int i; for(i = 0; i < l.n; i++) { TtfFont *tf = &(l.elem[i]); tf->LoadFontFromFile(true); } loaded = true; }
void TtfFontList::PlotString(char *font, char *str, double spacing, SBezierList *sbl, Vector origin, Vector u, Vector v) { LoadAll(); int i; for(i = 0; i < l.n; i++) { TtfFont *tf = &(l.elem[i]); if(strcmp(tf->FontFileBaseName(), font)==0) { tf->LoadFontFromFile(false); tf->PlotString(str, spacing, sbl, origin, u, v); return; } } // Couldn't find the font; so draw a big X for an error marker. SBezier sb; sb = SBezier::From(origin, origin.Plus(u).Plus(v)); sbl->l.Add(&sb); sb = SBezier::From(origin.Plus(v), origin.Plus(u)); sbl->l.Add(&sb); }