From eedd978974220a35c29caed14b7438ab864b693f Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sat, 18 Nov 2023 11:43:03 -0500 Subject: [PATCH] Tests: Add a type3 test pdf A manual test, but better than nothing. I hand-wrote the file, and used mutool to fix up xref and stream lengths: mutool clean Tests/LibPDF/type3.pdf Tests/LibPDF/type3.pdf The file contains one `d1` character which per spec shouldn't contain color statements, and if it does it should be ignored, and one `d0` character which can contain color. The text then sets a color before rendering the text. Per spec, the text color should affect the `d1` character but not the `d0` one. We get this wrong, but so does Preview.app. (PDFium gets it right.) But independent of the colors, just rendering the glyphs at all at the right position is already good :^) --- Tests/LibPDF/type3.pdf | 95 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Tests/LibPDF/type3.pdf diff --git a/Tests/LibPDF/type3.pdf b/Tests/LibPDF/type3.pdf new file mode 100644 index 0000000000..14e306f7f4 --- /dev/null +++ b/Tests/LibPDF/type3.pdf @@ -0,0 +1,95 @@ +%PDF-1.7 +%µ¶ + +1 0 obj +<> +endobj + +2 0 obj +<> +endobj + +3 0 obj +<>>>/Rotate 0/MediaBox[0 0 525 250]/Parent 2 0 R>> +endobj + +4 0 obj +<> +stream +BT +/F1 24 Tf +30 TL +40 220 Td +(There should be 5 triangles facing right) ' +(with colors blue green blue green blue:) ' +0 0 1 rg +/F2 24 Tf +(ababa) ' +ET + +endstream +endobj + +5 0 obj +<> +endobj + +6 0 obj +<>/Encoding/MacRomanEncoding/FirstChar 97/LastChar 98/Widths[10 10]/Resources<<>>>> +endobj + +7 0 obj +<> +stream +10 0 0 0 10 10 d1 +1 0 0 rg +0 0 m +8 5 l +0 10 l +0 0 l +f + +endstream +endobj + +8 0 obj +<> +stream +10 0 d0 +0 1 0 rg +0 0 m +8 5 l +0 10 l +0 0 l +f + +endstream +endobj + +9 0 obj +<> +endobj + +10 0 obj +9 0 R +endobj + +xref +0 11 +0000000000 65536 f +0000000016 00000 n +0000000074 00000 n +0000000126 00000 n +0000000257 00000 n +0000000457 00000 n +0000000555 00000 n +0000000761 00000 n +0000000864 00000 n +0000000957 00000 n +0000001092 00000 n + +trailer +<]>> +startxref +1115 +%%EOF