Skip to content

Commit 80a8e03

Browse files
committed
core: Handle font fallback for more known monospace fonts
This is based on the behavior of Flash: when no device font is available, Flash falls back to a monospace font for the following fonts: * Consolas * Courier * Courier New * NSimSun
1 parent f101687 commit 80a8e03

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/html/layout.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,10 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
719719
let default_font = match font_name.deref() {
720720
"Times New Roman" => DefaultFont::Serif,
721721
"Arial" => DefaultFont::Sans,
722+
"Consolas" => DefaultFont::Typewriter,
723+
"Courier" => DefaultFont::Typewriter,
722724
"Courier New" => DefaultFont::Typewriter,
725+
"NSimSun" => DefaultFont::Typewriter,
723726
_ => {
724727
if font_name.contains("Ming") || font_name.contains('明') {
725728
DefaultFont::JapaneseMincho

0 commit comments

Comments
 (0)