mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb+LibWebView: Include system math font in a font cascade list
Adds math symbols rendering support on linux (if it has "Noto Sans Math" font).
This commit is contained in:
parent
3b04c983f1
commit
257bab64b2
5 changed files with 23 additions and 2 deletions
|
@ -2051,6 +2051,10 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
||||||
font_list->add(*emoji_font);
|
font_list->add(*emoji_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto math_font = Platform::FontPlugin::the().default_math_font(font_size_in_pt); math_font) {
|
||||||
|
font_list->add(*math_font);
|
||||||
|
}
|
||||||
|
|
||||||
auto found_font = StyleProperties::font_fallback(monospace, bold);
|
auto found_font = StyleProperties::font_fallback(monospace, bold);
|
||||||
font_list->set_last_resort_font(found_font->with_size(font_size_in_pt));
|
font_list->set_last_resort_font(found_font->with_size(font_size_in_pt));
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
virtual Gfx::Font& default_font() = 0;
|
virtual Gfx::Font& default_font() = 0;
|
||||||
virtual Gfx::Font& default_fixed_width_font() = 0;
|
virtual Gfx::Font& default_fixed_width_font() = 0;
|
||||||
virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) = 0;
|
virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) = 0;
|
||||||
|
virtual RefPtr<Gfx::Font> default_math_font(float point_size) = 0;
|
||||||
|
|
||||||
virtual FlyString generic_font_name(GenericFont) = 0;
|
virtual FlyString generic_font_name(GenericFont) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,6 +79,11 @@ RefPtr<Gfx::Font> FontPlugin::default_emoji_font(float point_size)
|
||||||
return Gfx::FontDatabase::the().get(default_emoji_font_name, point_size, 400, Gfx::FontWidth::Normal, 0);
|
return Gfx::FontDatabase::the().get(default_emoji_font_name, point_size, 400, Gfx::FontWidth::Normal, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefPtr<Gfx::Font> FontPlugin::default_math_font(float point_size)
|
||||||
|
{
|
||||||
|
return Gfx::FontDatabase::the().get("Noto Sans Math"_fly_string, point_size, 400, Gfx::FontWidth::Normal, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_FONTCONFIG
|
#ifdef USE_FONTCONFIG
|
||||||
static Optional<String> query_fontconfig_for_generic_family(Web::Platform::GenericFont generic_font)
|
static Optional<String> query_fontconfig_for_generic_family(Web::Platform::GenericFont generic_font)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
virtual Gfx::Font& default_font() override;
|
virtual Gfx::Font& default_font() override;
|
||||||
virtual Gfx::Font& default_fixed_width_font() override;
|
virtual Gfx::Font& default_fixed_width_font() override;
|
||||||
virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) override;
|
virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) override;
|
||||||
|
virtual RefPtr<Gfx::Font> default_math_font(float point_size) override;
|
||||||
virtual FlyString generic_font_name(Web::Platform::GenericFont) override;
|
virtual FlyString generic_font_name(Web::Platform::GenericFont) override;
|
||||||
|
|
||||||
void update_generic_fonts();
|
void update_generic_fonts();
|
||||||
|
|
|
@ -2,8 +2,18 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
|
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||||
BlockContainer <body> at (8,16) content-size 784x17 children: not-inline
|
BlockContainer <body> at (8,16) content-size 784x17 children: not-inline
|
||||||
BlockContainer <p> at (8,16) content-size 784x17 children: inline
|
BlockContainer <p> at (8,16) content-size 784x17 children: inline
|
||||||
frag 0 from TextNode start: 0, length: 67, rect: [8,16 118.40625x17] baseline: 13.296875
|
frag 0 from TextNode start: 0, length: 16, rect: [8,16 29.171875x17] baseline: 13.296875
|
||||||
"𝑊𝑒𝑙𝑙, ℎ𝑒𝑙𝑙𝑜 𝑓𝑟𝑖𝑒𝑛𝑑𝑠!"
|
"𝑊𝑒𝑙𝑙"
|
||||||
|
frag 1 from TextNode start: 16, length: 2, rect: [37,16 13.046875x17] baseline: 13.296875
|
||||||
|
", "
|
||||||
|
frag 2 from TextNode start: 18, length: 19, rect: [50,16 33x17] baseline: 13.296875
|
||||||
|
"ℎ𝑒𝑙𝑙𝑜"
|
||||||
|
frag 3 from TextNode start: 37, length: 1, rect: [83,16 8x17] baseline: 13.296875
|
||||||
|
" "
|
||||||
|
frag 4 from TextNode start: 38, length: 28, rect: [91,16 44.171875x17] baseline: 13.296875
|
||||||
|
"𝑓𝑟𝑖𝑒𝑛𝑑𝑠"
|
||||||
|
frag 5 from TextNode start: 66, length: 1, rect: [135,16 3.859375x17] baseline: 13.296875
|
||||||
|
"!"
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
BlockContainer <(anonymous)> at (8,49) content-size 784x0 children: inline
|
BlockContainer <(anonymous)> at (8,49) content-size 784x0 children: inline
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
|
|
Loading…
Reference in a new issue