| 596 | } |
| 597 | |
| 598 | static 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 | |
| 626 | static int SysFonts_DoRegister(const cc_string* path, int faceIndex, SysFont_RegisterCallback callback) { |
| 627 | struct SysFont font; |
no test coverage detected