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
Notes: sideshowbarker 2024-07-17 14:12:45 +09:00

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()