diff --git a/Userland/Libraries/LibPDF/Fonts/CFF.cpp b/Userland/Libraries/LibPDF/Fonts/CFF.cpp index b88b483109..90428f13df 100644 --- a/Userland/Libraries/LibPDF/Fonts/CFF.cpp +++ b/Userland/Libraries/LibPDF/Fonts/CFF.cpp @@ -81,6 +81,36 @@ PDFErrorOr> CFF::create(ReadonlyBytes const& cff_bytes, RefPt Reader element_reader { element_data }; return parse_dict(element_reader, [&](TopDictOperator op, Vector const& operands) -> PDFErrorOr { switch (op) { + case TopDictOperator::Version: + case TopDictOperator::Notice: + case TopDictOperator::FullName: + case TopDictOperator::FamilyName: + case TopDictOperator::Weight: + case TopDictOperator::FontBBox: + case TopDictOperator::UniqueID: + case TopDictOperator::XUID: + case TopDictOperator::IsFixedPitch: + case TopDictOperator::ItalicAngle: + case TopDictOperator::UnderlinePosition: + case TopDictOperator::UnderlineThickness: + case TopDictOperator::PaintType: + case TopDictOperator::FontMatrix: + case TopDictOperator::StrokeWidth: + case TopDictOperator::PostScript: + case TopDictOperator::BaseFontName: + case TopDictOperator::BaseFontBlend: + break; + case TopDictOperator::CharstringType: { + int charstring_type = 2; + if (!operands.is_empty()) + charstring_type = operands[0].get(); + if (charstring_type != 2) + dbgln("CFF: has unimplemented CharstringType, might not look right"); + break; + } + case TopDictOperator::SyntheticBase: + dbgln("CFF: has unimplemented SyntheticBase, might not look right"); + break; case TopDictOperator::Encoding: { auto encoding_offset = 0; if (!operands.is_empty()) @@ -128,7 +158,8 @@ PDFErrorOr> CFF::create(ReadonlyBytes const& cff_bytes, RefPt })); break; } - default:; + default: + dbgln("CFF: Unhandled top dict entry {}", static_cast(op)); } return {}; }); diff --git a/Userland/Libraries/LibPDF/Fonts/CFF.h b/Userland/Libraries/LibPDF/Fonts/CFF.h index b43310c2ed..89cdc1de73 100644 --- a/Userland/Libraries/LibPDF/Fonts/CFF.h +++ b/Userland/Libraries/LibPDF/Fonts/CFF.h @@ -28,17 +28,24 @@ private: FamilyName, Weight, FontBBox, - // UniqueID = 13, - // XUID, + UniqueID = 13, + XUID, Charset = 15, Encoding, CharStrings, Private, - // IsFixedPitch = (12 << 8 | 1), - // ItalicAngle, - // UnderlinePosition, - // UnderlineThickness, - // PaintType, + IsFixedPitch = (12 << 8 | 1), + ItalicAngle, + UnderlinePosition, + UnderlineThickness, + PaintType, + CharstringType, + FontMatrix, + StrokeWidth, + SyntheticBase = (12 << 8 | 20), + PostScript, + BaseFontName, + BaseFontBlend, }; // CFF spec, "Table 23 Private DICT Operators"