1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Migrate SC::FontLoader from TTF::Font to Gfx::VectorFont

This commit is contained in:
Simon Wanner 2022-04-09 11:18:46 +02:00 committed by Andreas Kling
parent 17baf05c5a
commit f386b0d43c

View file

@ -14,6 +14,7 @@
#include <LibGfx/Font/FontStyleMapping.h>
#include <LibGfx/Font/ScaledFont.h>
#include <LibGfx/Font/TrueType/Font.h>
#include <LibGfx/Font/VectorFont.h>
#include <LibWeb/CSS/CSSFontFaceRule.h>
#include <LibWeb/CSS/CSSStyleRule.h>
#include <LibWeb/CSS/Parser/Parser.h>
@ -54,7 +55,7 @@ public:
auto result = TTF::Font::try_load_from_externally_owned_memory(resource()->encoded_data());
if (result.is_error())
return;
m_ttf_font = result.release_value();
m_vector_font = result.release_value();
m_style_computer.did_load_font(m_family_name);
}
@ -64,15 +65,15 @@ public:
RefPtr<Gfx::Font> font_with_point_size(float point_size) const
{
if (!m_ttf_font)
if (!m_vector_font)
return nullptr;
return adopt_ref(*new Gfx::ScaledFont(*m_ttf_font, point_size, point_size));
return adopt_ref(*new Gfx::ScaledFont(*m_vector_font, point_size, point_size));
}
private:
StyleComputer& m_style_computer;
FlyString m_family_name;
RefPtr<TTF::Font> m_ttf_font;
RefPtr<Gfx::VectorFont> m_vector_font;
};
static StyleSheet& default_stylesheet()