From 14ddab5519bdcf921e333c8106ed3063e92f861b Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 15 Nov 2023 07:47:17 -0500 Subject: [PATCH] LibPDF: Stub out type3_font_set_glyph_width* Type 3 font glyphs begin with either `d0` or `d1`. If we bail out with an "unsupported" error on the very first operator in a glyph, we'll never paint the glyph. Just stub these out for now. We probably want to do more in here in the future (see "TABLE 5.10 Type 3 font operators" in the 1.7 spec). --- Userland/Libraries/LibPDF/Fonts/Type3Font.cpp | 3 ++- Userland/Libraries/LibPDF/Renderer.cpp | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibPDF/Fonts/Type3Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type3Font.cpp index b4cb50d5ca..1cc3f14203 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type3Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type3Font.cpp @@ -55,8 +55,9 @@ void Type3Font::set_font_size(float) PDFErrorOr Type3Font::draw_glyph(Gfx::Painter&, Gfx::FloatPoint, float, u8 char_code, Renderer const&) { + // PDF 1.7 spec, 5.5.4 Type 3 Fonts: // "For each character code shown by a text-showing operator that uses a Type 3 font, - // the consumer application does the following:"" + // the consumer application does the following:" // "1. Looks up the character code in the font’s Encoding entry, as described in Sec- // tion 5.5.5, “Character Encoding,” to obtain a character name." diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index d5ddb96114..b2ef3abc3a 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -559,8 +559,17 @@ RENDERER_HANDLER(text_show_string_array) return {}; } -RENDERER_TODO(type3_font_set_glyph_width) -RENDERER_TODO(type3_font_set_glyph_width_and_bbox) +RENDERER_HANDLER(type3_font_set_glyph_width) +{ + // FIXME: Do something with this. + return {}; +} + +RENDERER_HANDLER(type3_font_set_glyph_width_and_bbox) +{ + // FIXME: Do something with this. + return {}; +} RENDERER_HANDLER(set_stroking_space) {