mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:27:35 +00:00
FontEditor: Display something for emoji glyphs
This commit makes FontEditor displaying emojis in GlyphMapWidget. They are not editable, what is marked by red background of a glyph. Additionally, a proper information is displayed in statusbar. Fixes #10900.
This commit is contained in:
parent
923bec28b7
commit
4d4764e0fb
2 changed files with 9 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
||||||
#include <LibGUI/ToolbarContainer.h>
|
#include <LibGUI/ToolbarContainer.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/BitmapFont.h>
|
#include <LibGfx/BitmapFont.h>
|
||||||
|
#include <LibGfx/Emoji.h>
|
||||||
#include <LibGfx/FontStyleMapping.h>
|
#include <LibGfx/FontStyleMapping.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
#include <LibGfx/TextDirection.h>
|
#include <LibGfx/TextDirection.h>
|
||||||
|
@ -742,6 +743,8 @@ void FontEditorWidget::update_statusbar()
|
||||||
|
|
||||||
if (m_edited_font->contains_raw_glyph(glyph))
|
if (m_edited_font->contains_raw_glyph(glyph))
|
||||||
builder.appendff(" [{}x{}]", m_edited_font->raw_glyph_width(glyph), m_edited_font->glyph_height());
|
builder.appendff(" [{}x{}]", m_edited_font->raw_glyph_width(glyph), m_edited_font->glyph_height());
|
||||||
|
else if (Gfx::Emoji::emoji_for_code_point(glyph))
|
||||||
|
builder.appendff(" [emoji]");
|
||||||
m_statusbar->set_text(builder.to_string());
|
m_statusbar->set_text(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "GlyphMapWidget.h"
|
#include "GlyphMapWidget.h"
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGfx/BitmapFont.h>
|
#include <LibGfx/BitmapFont.h>
|
||||||
|
#include <LibGfx/Emoji.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
|
||||||
GlyphMapWidget::GlyphMapWidget()
|
GlyphMapWidget::GlyphMapWidget()
|
||||||
|
@ -102,9 +103,14 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
|
||||||
painter.fill_rect(outer_rect, is_focused() ? palette().selection() : palette().inactive_selection());
|
painter.fill_rect(outer_rect, is_focused() ? palette().selection() : palette().inactive_selection());
|
||||||
if (m_font->contains_raw_glyph(glyph))
|
if (m_font->contains_raw_glyph(glyph))
|
||||||
painter.draw_glyph(inner_rect.location(), glyph, is_focused() ? palette().selection_text() : palette().inactive_selection_text());
|
painter.draw_glyph(inner_rect.location(), glyph, is_focused() ? palette().selection_text() : palette().inactive_selection_text());
|
||||||
|
else if (auto* emoji = Gfx::Emoji::emoji_for_code_point(glyph))
|
||||||
|
painter.draw_emoji(inner_rect.location(), *emoji, *m_font);
|
||||||
} else if (m_font->contains_raw_glyph(glyph)) {
|
} else if (m_font->contains_raw_glyph(glyph)) {
|
||||||
painter.fill_rect(outer_rect, palette().base());
|
painter.fill_rect(outer_rect, palette().base());
|
||||||
painter.draw_glyph(inner_rect.location(), glyph, palette().base_text());
|
painter.draw_glyph(inner_rect.location(), glyph, palette().base_text());
|
||||||
|
} else if (auto* emoji = Gfx::Emoji::emoji_for_code_point(glyph)) {
|
||||||
|
painter.fill_rect(outer_rect, Gfx::Color { 255, 150, 150 });
|
||||||
|
painter.draw_emoji(inner_rect.location(), *emoji, *m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue