Fix rendering issue regarding Type2 CIDFont with illegal CIDToCIDMap.

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), which
makes the CIDToGIDMaps illegal. Some PDFs use Type2 CIDFont which is
not embedded and contains stream object as CIDToGIDMap.

This CL modifies the steps of converting CIDs into unicodes.
In CPDF_CIDFont::GlyphFromCharCode(), no matter if |m_pStreamAcc|
exists or not, try to convert by using |m_pCID2UnicodeMap| first. If
|m_pCID2UnicodeMap| is not available while |m_pStreamAcc| is, then
use the |m_pCID2UnicodeMap| data to convert CIDs into unicodes.

Bug: pdfium:1308
Change-Id: I6cc145711b83d60ebc5f3451a3ef629de8750056
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/61050
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index e4128ea..f986ca9 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -594,7 +594,7 @@
   if (pVertGlyph)
     *pVertGlyph = false;
 
-  if (!m_pFontFile && !m_pStreamAcc) {
+  if (!m_pFontFile && (!m_pStreamAcc || m_pCID2UnicodeMap)) {
     uint16_t cid = CIDFromCharCode(charcode);
     wchar_t unicode = 0;
     if (m_bCIDIsGID) {
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 178e1d9..cb8b37d 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -328,9 +328,6 @@
 # TODO(pdfium:304): Remove after associated bug is fixed
 bug_304.pdf * * *
 
-# TODO(pdfium:1308): Remove after associated bug is fixed
-bug_1308.pdf * * *
-
 # TODO(pdfium:1331): Remove after associated bug is fixed
 bug_1331.in * * *
 
diff --git a/testing/resources/pixel/bug_1308_expected.pdf.0.png b/testing/resources/pixel/bug_1308_expected.pdf.0.png
index 3ac2e90..1c36944 100644
--- a/testing/resources/pixel/bug_1308_expected.pdf.0.png
+++ b/testing/resources/pixel/bug_1308_expected.pdf.0.png
Binary files differ