From 8eccc308c8adcdf26ffc7c4dd538b71f33c6f22b Mon Sep 17 00:00:00 2001 From: halcanary Date: Tue, 9 Aug 2016 13:04:34 -0700 Subject: 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 --- tests/PDFGlyphsToUnicodeTest.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'tests/PDFGlyphsToUnicodeTest.cpp') 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& glyphToUnicode, - const SkPDFGlyphSet* subset, - SkDynamicMemoryWStream* cmap, - bool multiByteGlyphs, - uint16_t firstGlypthID, - uint16_t lastGlypthID); - DEF_TEST(ToUnicode, reporter) { SkTDArray glyphToUnicode; SkTDArray 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\ -- cgit v1.2.3