Skip to content

Commit

Permalink
core: Handle font fallback for more known monospace fonts
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kjarosh committed Jan 6, 2025
1 parent f101687 commit 80a8e03
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,10 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
let default_font = match font_name.deref() {
"Times New Roman" => DefaultFont::Serif,
"Arial" => DefaultFont::Sans,
"Consolas" => DefaultFont::Typewriter,
"Courier" => DefaultFont::Typewriter,
"Courier New" => DefaultFont::Typewriter,
"NSimSun" => DefaultFont::Typewriter,
_ => {
if font_name.contains("Ming") || font_name.contains('明') {
DefaultFont::JapaneseMincho
Expand Down

0 comments on commit 80a8e03

Please sign in to comment.