mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23: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_BOOL_PROPERTY("font_fixed_width", is_font_fixed_width, set_font_fixed_width)
|
||||
register_property(
|
||||
"font_type", [this] { return m_font->is_fixed_width() ? "FixedWidth" : "Normal"; },
|
||||
[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()));
|
||||
}
|
||||
|
||||
bool Widget::is_font_fixed_width()
|
||||
{
|
||||
return font().is_fixed_width();
|
||||
}
|
||||
|
||||
void Widget::set_min_size(UISize const& size)
|
||||
{
|
||||
VERIFY(size.width().is_one_of(SpecialDimension::Regular, SpecialDimension::Shrink));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue