mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:07:36 +00:00
LibGfx: Make FontDatabase lookups take font (point) sizes as float
This will allow web content to ask for fractional sizes, which becomes important when converting between px/pt.
This commit is contained in:
parent
eeeaf410fb
commit
ee883372f6
4 changed files with 13 additions and 12 deletions
|
@ -161,20 +161,20 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name)
|
|||
return it->value;
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, unsigned size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match)
|
||||
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match)
|
||||
{
|
||||
for (auto typeface : m_private->typefaces) {
|
||||
if (typeface->family() == family && typeface->weight() == weight && typeface->slope() == slope)
|
||||
return typeface->get_font(size, allow_inexact_size_match);
|
||||
return typeface->get_font(point_size, allow_inexact_size_match);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& variant, unsigned size, Font::AllowInexactSizeMatch allow_inexact_size_match)
|
||||
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch allow_inexact_size_match)
|
||||
{
|
||||
for (auto typeface : m_private->typefaces) {
|
||||
if (typeface->family() == family && typeface->variant() == variant)
|
||||
return typeface->get_font(size, allow_inexact_size_match);
|
||||
return typeface->get_font(point_size, allow_inexact_size_match);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue