From f42e0d2d433ae126a32a604835598a1d8b7150f1 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Wed, 21 May 2025 16:25:53 -0400 Subject: pke: reference FontType via title over uuid --- src/font.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/font.cpp') 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(idx)]; } +FontType* FontType_GetByTitle(const pk_cstr title) { + assert(title.val != nullptr); + for (FontTypeIndex_T i = 0; i < static_cast(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; -- cgit v1.2.3