1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:47:46 +00:00

LibPDF: Record base font name read from document

This will be useful for debugging, or if we later on want to show all
the fonts found in the document in an organised manner.
This commit is contained in:
Rodrigo Tobar 2023-01-07 12:26:59 +08:00 committed by Andreas Kling
parent 2552399bcd
commit bfeca4ebb3
5 changed files with 8 additions and 3 deletions

View file

@ -33,9 +33,9 @@ static bool is_standard_latin_font(DeprecatedFlyString const& font)
PDFErrorOr<void> PDFFont::CommonData::load_from_dict(Document* document, NonnullRefPtr<DictObject> dict, float font_size)
{
auto base_font = TRY(dict->get_name(document, CommonNames::BaseFont))->name();
if ((is_standard_font = is_standard_latin_font(base_font))) {
auto replacement = replacement_for_standard_latin_font(base_font.to_lowercase());
base_font_name = TRY(dict->get_name(document, CommonNames::BaseFont))->name();
if ((is_standard_font = is_standard_latin_font(base_font_name))) {
auto replacement = replacement_for_standard_latin_font(base_font_name.to_lowercase());
font = Gfx::FontDatabase::the().get(replacement.get<0>(), replacement.get<1>(), font_size);
VERIFY(font);
}