feat: switch text to UTF-8; add Unicode key events, dead keys & Czech layout; fix numpad navigation; add NumLock support
This commit is contained in:
1 parent
32660ddd1a
commit
2aa6360b3d
101 files changed
+3733
-1639
No files matched your search
@@ -143,14 +143,8 @@ static gui::TrueTypeFont* load_page_font(const char* path) {
|
||||
|
||||
static void free_page_font(gui::TrueTypeFont* font) {
|
||||
if (!font) return;
|
||||
for (int i = 0; i < font->cache_count; i++) {
|
||||
for (int g = 0; g < 256; g++) {
|
||||
if (font->caches[i].glyphs[g].bitmap) {
|
||||
montauk::mfree(font->caches[i].glyphs[g].bitmap);
|
||||
font->caches[i].glyphs[g].bitmap = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < font->cache_count; i++)
|
||||
gui::TrueTypeFont::free_cache(&font->caches[i]);
|
||||
if (font->data) {
|
||||
montauk::free(font->data);
|
||||
font->data = nullptr;
|
||||
@@ -209,8 +203,8 @@ static void draw_text(uint8_t* rgb, PageFonts* fonts, bool bold,
|
||||
|
||||
int cx = x;
|
||||
int baseline = y + gc->ascent;
|
||||
for (int i = 0; text[i] != '\0'; i++) {
|
||||
gui::CachedGlyph* glyph = font->get_glyph(gc, (unsigned char)text[i]);
|
||||
for (const char* p = text; *p;) {
|
||||
gui::CachedGlyph* glyph = font->get_glyph(gc, (int)montauk::utf8::next(&p));
|
||||
if (!glyph) continue;
|
||||
|
||||
if (glyph->bitmap) {
|
||||
|
||||
Reference in new issue
Block a user