Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: src/pdf/SkPDFFont.cpp

Issue 2241683005: SkPDF: unify drawText and drawPosText (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: compile on win Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/pdf/SkPDFDevice.cpp ('K') | « src/pdf/SkPDFFont.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.cpp
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 769771ab236032e20cacbce780f2a842e0529a10..05dbdc7e55deabd8ba59c5b388018a1cf97355c2 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -498,7 +498,7 @@ bool SkPDFFont::hasGlyph(uint16_t id) {
return (id >= fFirstGlyphID && id <= fLastGlyphID) || id == 0;
}
-int SkPDFFont::glyphsToPDFFontEncoding(uint16_t* glyphIDs, int numGlyphs) {
+int SkPDFFont::glyphsToPDFFontEncoding(SkGlyphID* glyphIDs, int numGlyphs) const {
// A font with multibyte glyphs will support all glyph IDs in a single font.
if (this->multiByteGlyphs()) {
return numGlyphs;
@@ -517,6 +517,20 @@ int SkPDFFont::glyphsToPDFFontEncoding(uint16_t* glyphIDs, int numGlyphs) {
return numGlyphs;
}
+int SkPDFFont::glyphsToPDFFontEncodingCount(const SkGlyphID* glyphIDs,
+ int numGlyphs) const {
+ if (this->multiByteGlyphs()) { // A font with multibyte glyphs will
+ return numGlyphs; // support all glyph IDs in a single font.
+ }
+ for (int i = 0; i < numGlyphs; i++) {
+ if (glyphIDs[i] != 0 &&
+ (glyphIDs[i] < fFirstGlyphID || glyphIDs[i] > fLastGlyphID)) {
+ return i;
+ }
+ }
+ return numGlyphs;
+}
+
// static
SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
SkTypeface* typeface,
« src/pdf/SkPDFDevice.cpp ('K') | « src/pdf/SkPDFFont.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698