MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / SysFonts_Add

Function SysFonts_Add

src/SystemFonts.c:598–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598static void SysFonts_Add(const cc_string* path, FT_Face face, int index, char type, const char* defStyle) {
599 cc_string key; char keyBuffer[STRING_SIZE];
600 cc_string value; char valueBuffer[FILENAME_SIZE];
601 cc_string style = String_Empty;
602
603 if (!face->family_name || !(face->face_flags & FT_FACE_FLAG_SCALABLE)) return;
604 /* don't want 'Arial Regular' or 'Arial Bold' */
605 if (face->style_name) {
606 style = String_FromReadonly(face->style_name);
607 if (String_CaselessEqualsConst(&style, defStyle)) style.length = 0;
608 }
609 if (SysFonts_SkipFont(face)) type = 'X';
610
611 String_InitArray(key, keyBuffer);
612 if (style.length) {
613 String_Format3(&key, "%c %c %r", face->family_name, face->style_name, &type);
614 } else {
615 String_Format2(&key, "%c %r", face->family_name, &type);
616 }
617
618 String_InitArray(value, valueBuffer);
619 String_Format2(&value, "%s,%i", path, &index);
620
621 Platform_Log2("Face: %s = %s", &key, &value);
622 EntryList_Set(&font_list, &key, &value, '=');
623 fonts_changed = true;
624}
625
626static int SysFonts_DoRegister(const cc_string* path, int faceIndex, SysFont_RegisterCallback callback) {
627 struct SysFont font;

Callers 1

SysFonts_DoRegisterFunction · 0.85

Calls 7

String_FromReadonlyFunction · 0.85
SysFonts_SkipFontFunction · 0.85
String_Format3Function · 0.85
String_Format2Function · 0.85
Platform_Log2Function · 0.85
EntryList_SetFunction · 0.85

Tested by

no test coverage detected