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

Side by Side Diff: src/core/SkAdvancedTypefaceMetrics.cpp

Issue 113093004: [PDF] Fix font width generation when glyph 0 is used. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkAdvancedTypefaceMetrics.h" 10 #include "SkAdvancedTypefaceMetrics.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 firstIndex = static_cast<int>(subsetGlyphIDs[0]); 162 firstIndex = static_cast<int>(subsetGlyphIDs[0]);
163 lastIndex = 163 lastIndex =
164 static_cast<int>(subsetGlyphIDs[subsetGlyphIDsLength - 1]) + 1; 164 static_cast<int>(subsetGlyphIDs[subsetGlyphIDsLength - 1]) + 1;
165 } 165 }
166 curRange = appendRange(&result, firstIndex); 166 curRange = appendRange(&result, firstIndex);
167 167
168 for (int gId = firstIndex; gId <= lastIndex; gId++) { 168 for (int gId = firstIndex; gId <= lastIndex; gId++) {
169 Data advance = kInvalidAdvance; 169 Data advance = kInvalidAdvance;
170 if (gId < lastIndex) { 170 if (gId < lastIndex) {
171 // Get glyph id only when subset is NULL, or the id is in subset. 171 // Get glyph id only when subset is NULL, or the id is in subset.
172 SkASSERT(!subsetGlyphIDs || (subsetIndex < subsetGlyphIDsLength &&
173 static_cast<uint32_t>(gId) <= subsetGlyphIDs[subsetIndex]));
172 if (!subsetGlyphIDs || 174 if (!subsetGlyphIDs ||
173 (subsetIndex < subsetGlyphIDsLength && 175 (subsetIndex < subsetGlyphIDsLength &&
174 static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) { 176 static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) {
175 SkAssertResult(getAdvance(fontHandle, gId, &advance)); 177 SkAssertResult(getAdvance(fontHandle, gId, &advance));
176 ++subsetIndex; 178 ++subsetIndex;
177 } else { 179 } else {
178 advance = kDontCareAdvance; 180 advance = kDontCareAdvance;
179 } 181 }
180 } 182 }
181 if (advance == lastAdvance) { 183 if (advance == lastAdvance) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 308
307 // additional declaration needed for testing with a face of an unknown type 309 // additional declaration needed for testing with a face of an unknown type
308 template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData( 310 template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
309 void* fontData, 311 void* fontData,
310 int num_glyphs, 312 int num_glyphs,
311 const uint32_t* subsetGlyphIDs, 313 const uint32_t* subsetGlyphIDs,
312 uint32_t subsetGlyphIDsLength, 314 uint32_t subsetGlyphIDsLength,
313 bool (*getAdvance)(void* fontData, int gId, int16_t* data)); 315 bool (*getAdvance)(void* fontData, int gId, int16_t* data));
314 316
315 } // namespace skia_advanced_typeface_metrics_utils 317 } // namespace skia_advanced_typeface_metrics_utils
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698