diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-21 16:25:53 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-21 16:25:53 -0400 |
| commit | f42e0d2d433ae126a32a604835598a1d8b7150f1 (patch) | |
| tree | 40109c896005f8022531cd9a4c71b898983326d2 /src/font.cpp | |
| parent | 4b1615c76b5b4fe110eb01392c98eddaf03bb103 (diff) | |
pke: reference FontType via title over uuid
Diffstat (limited to 'src/font.cpp')
| -rw-r--r-- | src/font.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/font.cpp b/src/font.cpp index 35db13f..bd4d530 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -491,6 +491,17 @@ FontType* FontType_Get(FontTypeIndex idx) { return &ftd.arr_ft[static_cast<FontTypeIndex_T>(idx)]; } +FontType* FontType_GetByTitle(const pk_cstr title) { + assert(title.val != nullptr); + for (FontTypeIndex_T i = 0; i < static_cast<FontTypeIndex_T>(ftd.h_ft); ++i) { + if (ftd.arr_ft[i].title.val == title.val) + return &ftd.arr_ft[i]; + if (strcmp(ftd.arr_ft[i].title.val, title.val) == 0) + return &ftd.arr_ft[i]; + } + return nullptr; +} + FontType* FontType_GetFonts(FontTypeIndex &count) { count = ftd.h_ft; return ftd.arr_ft; |
