SkPDF: SkPDFFont organization changes.
SkPDFFont:
- SkPDFType1Font::populate() encode advances correctly.
- break out logically independent code into new files:
* SkPDFConvertType1FontStream
* SkPDFMakeToUnicodeCmap
SkPDFFont.cpp is now 380 lines smaller.
Expose `SkPDFAppendCmapSections()` for testing.
SkPDFFontImpl.h
- Fold into SkPDFFont.
SkPDFConvertType1FontStream:
- Now assume given a SkStreamAsset
SkPDFFont:
- AdvanceMetric now hidden in a anonymous namespace.
No public API changes.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221163002
Review-Url: https://codereview.chromium.org/2221163002
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index f0425d9..b8157ca 100644
--- a/tests/PDFGlyphsToUnicodeTest.cpp
+++ b/tests/PDFGlyphsToUnicodeTest.cpp
@@ -7,7 +7,7 @@
#include "SkData.h"
#include "SkPDFFont.h"
-#include "SkPDFTypes.h"
+#include "SkPDFMakeToUnicodeCmap.h"
#include "SkStream.h"
#include "Test.h"
@@ -23,13 +23,6 @@
return memcmp(data->bytes() + offset, buffer, len) == 0;
}
-void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
- const SkPDFGlyphSet* subset,
- SkDynamicMemoryWStream* cmap,
- bool multiByteGlyphs,
- uint16_t firstGlypthID,
- uint16_t lastGlypthID);
-
DEF_TEST(ToUnicode, reporter) {
SkTDArray<SkUnichar> glyphToUnicode;
SkTDArray<uint16_t> glyphsInSubset;
@@ -73,7 +66,7 @@
SkDynamicMemoryWStream buffer;
subset.set(glyphsInSubset.begin(), glyphsInSubset.count());
- append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 0, 0xFFFF);
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 0, 0xFFFF);
char expectedResult[] =
"4 beginbfchar\n\
@@ -95,7 +88,7 @@
// Remove characters and ranges.
buffer.reset();
- append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 8, 0x00FF);
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 8, 0x00FF);
char expectedResultChop1[] =
"2 beginbfchar\n\
@@ -113,7 +106,7 @@
// Remove characters from range to downdrade it to one char.
buffer.reset();
- append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 0x00D, 0x00FE);
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 0x00D, 0x00FE);
char expectedResultChop2[] =
"2 beginbfchar\n\
@@ -126,7 +119,7 @@
buffer.reset();
- append_cmap_sections(glyphToUnicode, nullptr, &buffer, false, 0xFC, 0x110);
+ SkPDFAppendCmapSections(glyphToUnicode, nullptr, &buffer, false, 0xFC, 0x110);
char expectedResultSingleBytes[] =
"2 beginbfchar\n\
@@ -162,7 +155,7 @@
SkDynamicMemoryWStream buffer2;
subset2.set(glyphsInSubset.begin(), glyphsInSubset.count());
- append_cmap_sections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff);
+ SkPDFAppendCmapSections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff);
char expectedResult2[] =
"4 beginbfchar\n\