Add a test for a non-embedded font with illegal CIDToGIDMap string.

The PDF Reference, Sixth Edition, specifies that a CIDToGIDMap "may
appear only in a Type 2 CIDFont whose associated True Type font
program is embedded in the PDF file" (Section 5.6, pp 437). But some
PDFs, which use Type 2 CIDFont, contain CIDToGIDMap as string
"Identity" even when the font is not embedded.

This CL adds a test case with the incorrect rendering suppressed.
PDFium is rendering CID <0004> as unicode <0041> ('A') by looking up
ToUnicode mapping and ignoring the illegal CIDToGIDMap, while the
expected result should be '!' (glyph index = 4) because it follows
the rule that when CIDToGIDMap's value is "Identity", glyph index
should be the same as charcode.

Bug: chromium:1021762
Change-Id: If9dd2cb8ff03142a39ca86076e72f75f281ec747
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62593
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index cb8b37d..36d4d2b 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -337,6 +337,9 @@
 # TODO(chromium:1012369): Remove after associated bug is fixed
 bug_1012369.in * * *
 
+# TODO(chromium:1021762): Remove after associated bug is fixed
+bug_1021762.in * * *
+
 # xfa_specific
 
 # TODO(pdfium:1107): Remove after associated bug is fixed
diff --git a/testing/resources/pixel/bug_1021762.in b/testing/resources/pixel/bug_1021762.in
new file mode 100644
index 0000000..a8f7be4
--- /dev/null
+++ b/testing/resources/pixel/bug_1021762.in
@@ -0,0 +1,101 @@
+{{header}}
+{{object 1 0}} <<
+  /Type /Catalog
+  /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+  /Type /Pages
+  /Count 1
+  /Kids [3 0 R]
+>>
+endobj
+{{object 3 0}} <<
+  /Type /Page
+  /Parent 2 0 R
+  /Contents 4 0 R
+  /Resources <<
+    /ProcSet [/PDF /Text]
+    /Font <<
+      /Ft11 5 0 R
+    >>
+  >>
+  /MediaBox [0 0 100 100]
+>>
+endobj
+{{object 4 0}} <<
+  {{streamlen}}
+>>
+stream
+0 0 0 rg
+BT
+/Ft11 20 Tf
+1 0 0 1 40 40 Tm
+<0004>Tj
+ET
+endstream
+endobj
+{{object 5 0}}  <<
+  /Type /Font
+  /Subtype /Type0
+  /BaseFont /Arial-BoldMT
+  /Encoding /Identity-H
+  /ToUnicode 8 0 R
+  /DescendantFonts [6 0 R]
+>>
+endobj
+{{object 6 0}} <<
+  /Type /Font
+  /Subtype /CIDFontType2
+  /BaseFont /Arial-BoldMT
+  /CIDToGIDMap /Identity
+  /CIDSystemInfo <<
+    /Registry (Adobe)
+    /Ordering (Identity)
+    /Supplement 0
+  >>
+  /FontDescriptor 7 0 R
+>>
+endobj
+{{object 7 0}} <<
+  /Type /FontDescriptor
+  /FontName /Arial-BoldMT
+  /Descent -211.914063
+  /Ascent 905.273438
+  /CapHeight 905.273438
+  /StemV 1
+  /Flags 32
+  /ItalicAngle 0
+  /FontBBox [-627.929688 -376.464844 2000.000000 1055.664063]
+>>
+endobj
+{{object 8 0}} <<
+  {{streamlen}}
+>>
+stream
+/CIDInit /ProcSet findresource begin
+10000 dict begin
+begincmap
+/CIDSystemInfo <<
+/Registry (Adobe)
+/Ordering (UCS)
+/Supplement 0
+>> def
+/CMapName /Adobe-Identity-UCS def
+/CMapType 2 def
+1 begincodespacerange
+<0000> <FFFF>
+endcodespacerange
+99 beginbfrange
+<0004> <0004> [ <0041> ]
+endbfrange
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1021762_expected.pdf.0.png b/testing/resources/pixel/bug_1021762_expected.pdf.0.png
new file mode 100644
index 0000000..8ba763c
--- /dev/null
+++ b/testing/resources/pixel/bug_1021762_expected.pdf.0.png
Binary files differ