aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFont.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-11 23:54:31 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-11 23:54:31 +0000
commit4da3bfc5b2a44a4904286683d772c584bfa09787 (patch)
treec140322bcda64b8740c3ed3e4d87bce728412a76 /src/pdf/SkPDFFont.cpp
parent398337b3a5d66a7db5d36a3b5182e4407e2292f7 (diff)
[PDF] Fix font width generation when glyph 0 is used.
Using glyph 0 caused gid 0 to be in the subset list twice, which violated an assumption in the code. Added an assert for the assumption and updated the code to not insert gid 0 into the subset list twice. BUG=skia:1889 R=bungeman@google.com Author: vandebo@chromium.org Review URL: https://codereview.chromium.org/113093004 git-svn-id: http://skia.googlecode.com/svn/trunk@12632 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pdf/SkPDFFont.cpp')
-rw-r--r--src/pdf/SkPDFFont.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index ef9c3bbc04..07ecbba37e 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -1156,8 +1156,11 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
if (fontInfo()->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) {
// Generate glyph id array.
SkTDArray<uint32_t> glyphIDs;
- glyphIDs.push(0); // Always include glyph 0.
if (subset) {
+ // Always include glyph 0.
+ if (!subset->has(0)) {
+ glyphIDs.push(0);
+ }
subset->exportTo(&glyphIDs);
}
@@ -1165,7 +1168,7 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
info = SkAdvancedTypefaceMetrics::kGlyphNames_PerGlyphInfo;
info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>(
info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo);
- uint32_t* glyphs = (glyphIDs.count() == 1) ? NULL : glyphIDs.begin();
+ uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin();
uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0;
SkAutoTUnref<SkAdvancedTypefaceMetrics> fontMetrics(
typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount));