Skip to content

Commit

Permalink
Allow spaces in font list
Browse files Browse the repository at this point in the history
  • Loading branch information
dancazarin committed Feb 10, 2025
1 parent 443d043 commit c708b64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/graphics/Fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ FontManager::~FontManager() {

std::vector<std::string_view> FontManager::fontList(std::string_view ff) const {
std::vector<std::string_view> list = split(ff, ',');
for (std::string_view& sv : list) {
sv = trim(sv);
}
return list;
}

Expand All @@ -577,6 +580,8 @@ std::pair<FontFace*, GlyphID> FontManager::lookupCodepoint(const Font& font, cha
return { nullptr, UINT32_MAX };
auto list = fontList(font.fontFamily);
for (int offset = 0; offset < list.size(); ++offset) {
if (list[offset].empty())
continue;
FontFace* face = findFontByKey(FontKey{ list[offset], font.style, font.weight });
if (face) {
GlyphID id = FT_Get_Char_Index(face->face, (FT_ULong)(codepoint));
Expand Down

0 comments on commit c708b64

Please sign in to comment.