mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 03:26:10 +00:00
LibGfx+LibWeb: Allow inexact size lookups when requesting scaled fonts
For bitmap fonts, we will often not have an exact match for requested sizes. Return the closest match instead of a nullptr. LibWeb is currently the only user of this API. If it needs to be configurable in the future to only allow exact matches, we can add a parameter or another method at that time.
This commit is contained in:
parent
8f784243a1
commit
464d7d5858
Notes:
sideshowbarker
2024-07-16 22:14:49 +09:00
Author: https://github.com/trflynn89
Commit: 464d7d5858
Pull-request: https://github.com/SerenityOS/serenity/pull/24243
Issue: https://github.com/SerenityOS/serenity/issues/24238
12 changed files with 17 additions and 18 deletions
|
@ -89,8 +89,8 @@ void CommandList::execute(CommandExecutor& executor)
|
|||
for (auto const& glyph_or_emoji : command.get<DrawGlyphRun>().glyph_run->glyphs()) {
|
||||
if (glyph_or_emoji.has<Gfx::DrawGlyph>()) {
|
||||
auto const& glyph = glyph_or_emoji.get<Gfx::DrawGlyph>();
|
||||
auto const& font = *glyph.font->with_size(glyph.font->point_size() * static_cast<float>(scale));
|
||||
unique_glyphs.ensure(&font, [] { return HashTable<u32> {}; }).set(glyph.code_point);
|
||||
auto font = glyph.font->with_size(glyph.font->point_size() * static_cast<float>(scale));
|
||||
unique_glyphs.ensure(font, [] { return HashTable<u32> {}; }).set(glyph.code_point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue