aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PDFGlyphsToUnicodeTest.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-08-18 14:22:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-18 14:22:52 -0700
commit530032a18e373ee673ae96fdbfa1fae6292f8f08 (patch)
tree5edb6e14ca33bf75d3d7b1df73da47be56337b3a /tests/PDFGlyphsToUnicodeTest.cpp
parent9637ea91b88ff8f8e95325bfc41417ffc4d5ee0b (diff)
SkPDF: in-place font subsetting
Motivation: gross code simplification, also no bitset lookups at draw time. SkPDFFont owns its glyph useage bitset. SkPDFSubstituteMap goes away. SkPDFObject interface is simplified. SkPDFDocument tracks font usage (as hash set), not glyph usage. SkPDFFont gets a simpler constructor. SkPDFFont has first and last glyph set in constructor, not adjusted later. SkPDFFont implementations are simplified. SkPDFGlyphSet is replaced with simple SkBitSet. SkPDFFont sizes its SkBitSets based on glyph count. SkPDFGlyphSetMap goes away. SkBitSet is now non-copyable. SkBitSet now how utility methods to match old SkPDFGlyphSet. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253283004 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot Review-Url: https://codereview.chromium.org/2253283004
Diffstat (limited to 'tests/PDFGlyphsToUnicodeTest.cpp')
-rw-r--r--tests/PDFGlyphsToUnicodeTest.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index b8157caeea..d83ce664bc 100644
--- a/tests/PDFGlyphsToUnicodeTest.cpp
+++ b/tests/PDFGlyphsToUnicodeTest.cpp
@@ -5,12 +5,14 @@
* found in the LICENSE file.
*/
+#include "SkBitSet.h"
#include "SkData.h"
-#include "SkPDFFont.h"
#include "SkPDFMakeToUnicodeCmap.h"
#include "SkStream.h"
#include "Test.h"
+static const int kMaximumGlyphCount = SK_MaxU16 + 1;
+
static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
const char* buffer, size_t len) {
sk_sp<SkData> data(stream.copyToData());
@@ -26,7 +28,7 @@ static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
DEF_TEST(ToUnicode, reporter) {
SkTDArray<SkUnichar> glyphToUnicode;
SkTDArray<uint16_t> glyphsInSubset;
- SkPDFGlyphSet subset;
+ SkBitSet subset(kMaximumGlyphCount);
glyphToUnicode.push(0); // 0
glyphToUnicode.push(0); // 1
@@ -65,7 +67,7 @@ DEF_TEST(ToUnicode, reporter) {
glyphToUnicode.push(0x1013);
SkDynamicMemoryWStream buffer;
- subset.set(glyphsInSubset.begin(), glyphsInSubset.count());
+ subset.setAll(glyphsInSubset.begin(), glyphsInSubset.count());
SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 0, 0xFFFF);
char expectedResult[] =
@@ -136,7 +138,7 @@ endbfrange\n";
glyphToUnicode.reset();
glyphsInSubset.reset();
- SkPDFGlyphSet subset2;
+ SkBitSet subset2(kMaximumGlyphCount);
// Test mapping:
// I n s t a l
@@ -154,7 +156,7 @@ endbfrange\n";
glyphsInSubset.push(0x57);
SkDynamicMemoryWStream buffer2;
- subset2.set(glyphsInSubset.begin(), glyphsInSubset.count());
+ subset2.setAll(glyphsInSubset.begin(), glyphsInSubset.count());
SkPDFAppendCmapSections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff);
char expectedResult2[] =