mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb+LibWebView: Allow to specify default font size in FontPlugin
Instead of always assuming 12pt size for default font, explicitly pass it as a parameter.
This commit is contained in:
parent
1be55fe793
commit
0b8b690f92
Notes:
github-actions[bot]
2025-01-02 09:48:33 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 0b8b690f92
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3101
9 changed files with 22 additions and 24 deletions
|
@ -43,14 +43,14 @@ void ImageBox::prepare_for_replaced_layout()
|
|||
set_natural_width(0);
|
||||
set_natural_height(0);
|
||||
} else {
|
||||
auto const& font = Platform::FontPlugin::the().default_font();
|
||||
auto font = Platform::FontPlugin::the().default_font(12);
|
||||
CSSPixels alt_text_width = 0;
|
||||
if (!m_cached_alt_text_width.has_value())
|
||||
m_cached_alt_text_width = CSSPixels::nearest_value_for(font.width(alt));
|
||||
m_cached_alt_text_width = CSSPixels::nearest_value_for(font->width(alt));
|
||||
alt_text_width = m_cached_alt_text_width.value();
|
||||
|
||||
set_natural_width(alt_text_width + 16);
|
||||
set_natural_height(CSSPixels::nearest_value_for(font.pixel_size()) + 16);
|
||||
set_natural_height(CSSPixels::nearest_value_for(font->pixel_size()) + 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue