mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
Ladybird/FontPluginQt: Implement default font virtuals
This commit is contained in:
parent
c230264c63
commit
3628eda0db
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3628eda0db Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg
@ -28,10 +28,24 @@ FontPluginQt::FontPluginQt()
|
||||
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
|
||||
|
||||
update_generic_fonts();
|
||||
|
||||
auto default_font_name = generic_font_name(Web::Platform::GenericFont::UiSansSerif);
|
||||
m_default_font = Gfx::FontDatabase::the().get(default_font_name, 12.0, 400, 0);
|
||||
VERIFY(m_default_font);
|
||||
}
|
||||
|
||||
FontPluginQt::~FontPluginQt() = default;
|
||||
|
||||
Gfx::Font& FontPluginQt::default_font()
|
||||
{
|
||||
return *m_default_font;
|
||||
}
|
||||
|
||||
Gfx::Font& FontPluginQt::default_fixed_width_font()
|
||||
{
|
||||
return *m_default_fixed_width_font;
|
||||
}
|
||||
|
||||
void FontPluginQt::update_generic_fonts()
|
||||
{
|
||||
// How we choose which system font to use for each CSS font:
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Platform/FontPlugin.h>
|
||||
|
||||
@ -16,12 +17,16 @@ public:
|
||||
FontPluginQt();
|
||||
virtual ~FontPluginQt();
|
||||
|
||||
virtual Gfx::Font& default_font() override;
|
||||
virtual Gfx::Font& default_fixed_width_font() override;
|
||||
virtual String generic_font_name(Web::Platform::GenericFont) override;
|
||||
|
||||
void update_generic_fonts();
|
||||
|
||||
private:
|
||||
Vector<String> m_generic_font_names;
|
||||
RefPtr<Gfx::Font> m_default_font;
|
||||
RefPtr<Gfx::Font> m_default_fixed_width_font;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user