mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
LibGUI: Add direct property for fixed-width font
There's the "font_type" property which currently only handles fixed-width yes/no, so until we get a proper font type enum and associated enum property, this is better to use from GML instead of a special case in the GML compiler.
This commit is contained in:
parent
bb471451e0
commit
2e46e33a9b
2 changed files with 7 additions and 0 deletions
|
@ -88,6 +88,7 @@ Widget::Widget()
|
||||||
|
|
||||||
REGISTER_STRING_PROPERTY("title", title, set_title);
|
REGISTER_STRING_PROPERTY("title", title, set_title);
|
||||||
|
|
||||||
|
REGISTER_BOOL_PROPERTY("font_fixed_width", is_font_fixed_width, set_font_fixed_width)
|
||||||
register_property(
|
register_property(
|
||||||
"font_type", [this] { return m_font->is_fixed_width() ? "FixedWidth" : "Normal"; },
|
"font_type", [this] { return m_font->is_fixed_width() ? "FixedWidth" : "Normal"; },
|
||||||
[this](auto& value) {
|
[this](auto& value) {
|
||||||
|
@ -841,6 +842,11 @@ void Widget::set_font_fixed_width(bool fixed_width)
|
||||||
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
|
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Widget::is_font_fixed_width()
|
||||||
|
{
|
||||||
|
return font().is_fixed_width();
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::set_min_size(UISize const& size)
|
void Widget::set_min_size(UISize const& size)
|
||||||
{
|
{
|
||||||
VERIFY(size.width().is_one_of(SpecialDimension::Regular, SpecialDimension::Shrink));
|
VERIFY(size.width().is_one_of(SpecialDimension::Regular, SpecialDimension::Shrink));
|
||||||
|
|
|
@ -295,6 +295,7 @@ public:
|
||||||
void set_font_size(unsigned);
|
void set_font_size(unsigned);
|
||||||
void set_font_weight(unsigned);
|
void set_font_weight(unsigned);
|
||||||
void set_font_fixed_width(bool);
|
void set_font_fixed_width(bool);
|
||||||
|
bool is_font_fixed_width();
|
||||||
|
|
||||||
void notify_layout_changed(Badge<Layout>);
|
void notify_layout_changed(Badge<Layout>);
|
||||||
void invalidate_layout();
|
void invalidate_layout();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue