aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PDFGlyphsToUnicodeTest.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-08-09 13:04:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-09 13:04:34 -0700
commit8eccc308c8adcdf26ffc7c4dd538b71f33c6f22b (patch)
treea05b3bfa26ccf05e733b0776a0e1fe788fad5528 /tests/PDFGlyphsToUnicodeTest.cpp
parent9bc1187249f27ffed448b49ad75fd226d8181241 (diff)
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
Diffstat (limited to 'tests/PDFGlyphsToUnicodeTest.cpp')
-rw-r--r--tests/PDFGlyphsToUnicodeTest.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index f0425d94fc..b8157caeea 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 @@ static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
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 @@ DEF_TEST(ToUnicode, reporter) {
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 @@ endbfrange\n";
// 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 @@ endbfrange\n";
// 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 @@ endbfchar\n";
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 @@ endbfrange\n";
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\