mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibGfx+FontEditor: Account for raw width when painting glyphs
Fixes hidden glyphs being painted in editor and map, and '?' subsitute glyphs being overdrawn in the system.
This commit is contained in:
parent
0664fbd584
commit
cc7744f6ca
3 changed files with 9 additions and 4 deletions
|
@ -147,7 +147,7 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event)
|
|||
for (int y = 0; y < font().glyph_height(); ++y) {
|
||||
for (int x = 0; x < font().max_glyph_width(); ++x) {
|
||||
Gfx::IntRect rect { x * m_scale, y * m_scale, m_scale, m_scale };
|
||||
if (x >= font().glyph_width(m_glyph)) {
|
||||
if (x >= font().raw_glyph_width(m_glyph)) {
|
||||
painter.fill_rect(rect, palette().threed_shadow1());
|
||||
} else {
|
||||
if (bitmap.bit_at(x, y))
|
||||
|
|
|
@ -98,6 +98,7 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
|
|||
font().glyph_height());
|
||||
if (glyph == m_selected_glyph) {
|
||||
painter.fill_rect(outer_rect, is_focused() ? palette().selection() : palette().inactive_selection());
|
||||
if (m_font->contains_glyph(glyph))
|
||||
painter.draw_glyph(inner_rect.location(), glyph, is_focused() ? palette().selection_text() : palette().inactive_selection_text());
|
||||
} else if (m_font->contains_glyph(glyph)) {
|
||||
painter.fill_rect(outer_rect, palette().base());
|
||||
|
|
|
@ -241,8 +241,12 @@ Glyph BitmapFont::glyph(u32 code_point) const
|
|||
|
||||
int BitmapFont::glyph_or_emoji_width(u32 code_point) const
|
||||
{
|
||||
if (code_point < m_glyph_count)
|
||||
if (code_point < m_glyph_count) {
|
||||
if (m_glyph_widths[code_point] > 0)
|
||||
return glyph_width(code_point);
|
||||
else
|
||||
return glyph_width('?');
|
||||
}
|
||||
|
||||
if (m_fixed_width)
|
||||
return m_glyph_width;
|
||||
|
|
Loading…
Add table
Reference in a new issue