aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDevice.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-08-05 13:51:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-05 13:51:46 -0700
commit462d0148a5c9433a1f9c26d947a07ca7f70cf09d (patch)
treee742035f5ee9e8c3cb03636eabf494ca257b3228 /src/pdf/SkPDFDevice.cpp
parentae2964452bd679ca34b275911a9d0d01a35983b9 (diff)
SkPDF: Stop using kHAdvance_PerGlyphInfo
SkPDFFont: - never request kHAdvance_PerGlyphInfo from typeface. - set_glyph_widths() fn uses a glyph cache to get advances. - stop expecting vertical advances that are never requested. - composeAdvanceData() now non-templated - appendAdvance() one-line function removed SkPDFDevice: - use a glyph cache for getting repeated advances. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2219733004 Review-Url: https://codereview.chromium.org/2219733004
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r--src/pdf/SkPDFDevice.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 7d025780a6..b9e1f3b48b 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1270,6 +1270,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
const uint16_t* glyphIDs = nullptr;
size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ SkAutoGlyphCache autoGlyphCache(textPaint, nullptr, nullptr);
content.entry()->fContent.writeText("BT\n");
this->updateFont(textPaint, glyphIDs[0], content.entry());
@@ -1280,6 +1281,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
for (size_t i = 0; i < numGlyphs; i++) {
SkPDFFont* font = content.entry()->fState.fFont;
uint16_t encodedValue = glyphIDs[i];
+ SkScalar advanceWidth = autoGlyphCache->getGlyphIDAdvance(encodedValue).fAdvanceX;
if (font->glyphsToPDFFontEncoding(&encodedValue, 1) != 1) {
// The current pdf font cannot encode the current glyph.
// Try to get a pdf font which can encode the current glyph.
@@ -1292,13 +1294,11 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
continue;
}
}
-
fontGlyphUsage->noteGlyphUsage(font, &encodedValue, 1);
SkScalar x = offset.x() + pos[i * scalarsPerPos];
SkScalar y = offset.y() + (2 == scalarsPerPos ? pos[i * scalarsPerPos + 1] : 0);
align_text(textPaint, glyphIDs + i, 1, &x, &y);
- SkScalar advanceWidth = textPaint.measureText(&encodedValue, sizeof(uint16_t));
glyphPositioner.writeGlyph(x, y, advanceWidth, encodedValue);
}
glyphPositioner.flush(); // Must flush before ending text object.