LibGfx: Painter, extend fonts to 384 character to support LatinExtendedA

Replace codepoint variable type from char to u32.
This commit is contained in:
Hüseyin ASLITÜRK 2020-05-16 22:21:19 +03:00 committed by Andreas Kling
parent 8790d6bafc
commit 840a64e2f9
Notes: sideshowbarker 2024-07-19 06:18:18 +09:00
2 changed files with 8 additions and 8 deletions

View file

@ -764,14 +764,14 @@ void Painter::draw_scaled_bitmap(const Rect& a_dst_rect, const Gfx::Bitmap& sour
}
}
FLATTEN void Painter::draw_glyph(const Point& point, char ch, Color color)
FLATTEN void Painter::draw_glyph(const Point& point, u32 codepoint, Color color)
{
draw_glyph(point, ch, font(), color);
draw_glyph(point, codepoint, font(), color);
}
FLATTEN void Painter::draw_glyph(const Point& point, char ch, const Font& font, Color color)
FLATTEN void Painter::draw_glyph(const Point& point, u32 codepoint, const Font& font, Color color)
{
draw_bitmap(point, font.glyph_bitmap(ch), color);
draw_bitmap(point, font.glyph_bitmap(codepoint), color);
}
void Painter::draw_emoji(const Point& point, const Gfx::Bitmap& emoji, const Font& font)
@ -791,9 +791,9 @@ void Painter::draw_emoji(const Point& point, const Gfx::Bitmap& emoji, const Fon
void Painter::draw_glyph_or_emoji(const Point& point, u32 codepoint, const Font& font, Color color)
{
if (codepoint < 256) {
if (codepoint < (u32)font.glyph_count()) {
// This looks like a regular character.
draw_glyph(point, (char)codepoint, font, color);
draw_glyph(point, (size_t)codepoint, font, color);
return;
}

View file

@ -76,8 +76,8 @@ public:
void draw_text(const Rect&, const StringView&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
void draw_text(const Rect&, const Utf32View&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
void draw_text(const Rect&, const Utf32View&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
void draw_glyph(const Point&, char, Color);
void draw_glyph(const Point&, char, const Font&, Color);
void draw_glyph(const Point&, u32, Color);
void draw_glyph(const Point&, u32, const Font&, Color);
void draw_emoji(const Point&, const Gfx::Bitmap&, const Font&);
void draw_glyph_or_emoji(const Point&, u32 codepoint, const Font&, Color);