From 323b7021bca849b51c031680e99a588994b80bd0 Mon Sep 17 00:00:00 2001 From: Dmitrii Trifonov Date: Thu, 8 Apr 2021 14:39:26 +0300 Subject: [PATCH] LibGfx: Added dirty and raw cyrillic support for bitmap fonts. This is a very quick and diry hack to implement support for cyrillic bitmap fonts. --- Userland/Libraries/LibGfx/BitmapFont.cpp | 5 +++++ Userland/Libraries/LibGfx/BitmapFont.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index 376525064b6..ab6b9ffb803 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -145,6 +145,8 @@ RefPtr BitmapFont::load_from_memory(const u8* data) type = FontTypes::Default; else if (header.type == 1) type = FontTypes::LatinExtendedA; + else if (header.type == 2) + type = FontTypes::Cyrillic; else VERIFY_NOT_REACHED(); @@ -166,6 +168,9 @@ size_t BitmapFont::glyph_count_by_type(FontTypes type) if (type == FontTypes::LatinExtendedA) return 384; + if (type == FontTypes::Cyrillic) + return 1280; + dbgln("Unknown font type: {}", (int)type); VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index 88ada2a2b75..47dfb290396 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.h +++ b/Userland/Libraries/LibGfx/BitmapFont.h @@ -38,7 +38,10 @@ namespace Gfx { enum FontTypes { Default = 0, - LatinExtendedA = 1 + LatinExtendedA = 1, + // There are many blocks between LatinExtendedA and Cyrrilic that has to be added later. + // Cyrrilic has to be switched to another number + Cyrillic = 2 }; class BitmapFont : public Font {