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

Side by Side Diff: src/fonts/SkTestScalerContext.cpp

Issue 2292303004: SkPDF: Fix Type3 ToUnicode table. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/pdf/SkPDFFont.cpp » ('j') | src/pdf/SkPDFFont.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 rec->setHinting(SkPaint::kNo_Hinting); 143 rec->setHinting(SkPaint::kNo_Hinting);
144 } 144 }
145 145
146 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics( 146 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics(
147 PerGlyphInfo , 147 PerGlyphInfo ,
148 const uint32_t* glyphIDs, 148 const uint32_t* glyphIDs,
149 uint32_t glyphIDsCount) const { 149 uint32_t glyphIDsCount) const {
150 // pdf only 150 // pdf only
151 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; 151 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
152 info->fFontName.set(fTestFont->fName); 152 info->fFontName.set(fTestFont->fName);
153 info->fLastGlyphID = SkToU16(onCountGlyphs() - 1); 153 int glyphCount = this->onCountGlyphs();
154 info->fLastGlyphID = SkToU16(glyphCount - 1);
155
156 SkTDArray<SkUnichar>& toUnicode = info->fGlyphToUnicode;
157 toUnicode.setCount(glyphCount);
158 SkASSERT(glyphCount == SkToInt(fTestFont->fCharCodesCount));
159 for (int gid = 0; gid < glyphCount; ++gid) {
160 toUnicode[gid] = SkToS32(fTestFont->fCharCodes[gid]);
161 }
154 return info; 162 return info;
155 } 163 }
156 164
157 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const { 165 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const {
158 desc->setFamilyName(fTestFont->fName); 166 desc->setFamilyName(fTestFont->fName);
159 desc->setStyle(this->fontStyle()); 167 desc->setStyle(this->fontStyle());
160 *isLocal = false; 168 *isLocal = false;
161 } 169 }
162 170
163 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, 171 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 290
283 private: 291 private:
284 SkTestTypeface* fFace; 292 SkTestTypeface* fFace;
285 SkMatrix fMatrix; 293 SkMatrix fMatrix;
286 }; 294 };
287 295
288 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffe cts& effects, 296 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffe cts& effects,
289 const SkDescriptor* desc) const { 297 const SkDescriptor* desc) const {
290 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, d esc); 298 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, d esc);
291 } 299 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFFont.cpp » ('j') | src/pdf/SkPDFFont.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698