mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +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
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)
|
Tuple<DeprecatedString, DeprecatedString> PDFFont::replacement_for_standard_latin_font(StringView name)
|
||||||
{
|
{
|
||||||
bool is_bold = name.contains("bold"sv);
|
bool is_bold = name.contains("bold"sv, CaseSensitivity::CaseInsensitive);
|
||||||
bool is_italic = name.contains("italic"sv);
|
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;
|
DeprecatedString font_variant;
|
||||||
|
|
||||||
|
@ -104,7 +113,7 @@ Tuple<DeprecatedString, DeprecatedString> PDFFont::replacement_for_standard_lati
|
||||||
font_variant = "Regular";
|
font_variant = "Regular";
|
||||||
}
|
}
|
||||||
|
|
||||||
return { "Liberation Serif", font_variant };
|
return { font_family, font_variant };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue