Skip to content

Commit 488e1d4

Browse files
Revert "Optimize TextUtils_findGlyph to be O(1) instead of O(n)"
This reverts commit c389db7. This was reverted because this change breaks custom fonts
1 parent c389db7 commit 488e1d4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/text_utils.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
// Used by both the renderer (for drawing text) and the VM (for string_width/string_height).
1515

1616
static inline FontGlyph* TextUtils_findGlyph(Font* font, uint16_t ch) {
17-
if (ch >= font->rangeStart && font->rangeEnd >= ch) {
18-
uint32_t index = ch - font->rangeStart;
19-
if (font->glyphCount > index) return &font->glyphs[index];
17+
repeat(font->glyphCount, i) {
18+
if (font->glyphs[i].character == ch) return &font->glyphs[i];
2019
}
2120
return nullptr;
2221
}

0 commit comments

Comments
 (0)