mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibPDF: Use more appropriate standard 14 replacement fonts
The mapping of standard font to replacement now looks like this: Times New Roman -> Liberation Serif Courier -> Liberation Mono Helvetica, Arial -> Liberation Sans
This commit is contained in:
parent
d470df1c6a
commit
152a8c5c43
Notes:
sideshowbarker
2024-07-17 10:16:43 +09:00
Author: https://github.com/janso3 Commit: https://github.com/SerenityOS/serenity/commit/152a8c5c43 Pull-request: https://github.com/SerenityOS/serenity/pull/17387
1 changed files with 12 additions and 3 deletions
|
@ -89,8 +89,17 @@ PDFErrorOr<NonnullRefPtr<PDFFont>> PDFFont::create(Document* document, NonnullRe
|
|||
|
||||
Tuple<DeprecatedString, DeprecatedString> PDFFont::replacement_for_standard_latin_font(StringView name)
|
||||
{
|
||||
bool is_bold = name.contains("bold"sv);
|
||||
bool is_italic = name.contains("italic"sv);
|
||||
bool is_bold = name.contains("bold"sv, CaseSensitivity::CaseInsensitive);
|
||||
bool is_italic = name.contains("italic"sv, CaseSensitivity::CaseInsensitive);
|
||||
|
||||
DeprecatedString font_family;
|
||||
if (name.contains("times"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
font_family = "Liberation Serif";
|
||||
} else if (name.contains("courier"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
font_family = "Liberation Mono";
|
||||
} else {
|
||||
font_family = "Liberation Sans";
|
||||
}
|
||||
|
||||
DeprecatedString font_variant;
|
||||
|
||||
|
@ -104,7 +113,7 @@ Tuple<DeprecatedString, DeprecatedString> PDFFont::replacement_for_standard_lati
|
|||
font_variant = "Regular";
|
||||
}
|
||||
|
||||
return { "Liberation Serif", font_variant };
|
||||
return { font_family, font_variant };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue