OLD | NEW |
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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 rec->setContrast(defaultRenderingParams->GetEnhancedContrast()); | 278 rec->setContrast(defaultRenderingParams->GetEnhancedContrast()); |
279 } | 279 } |
280 } | 280 } |
281 #endif | 281 #endif |
282 } | 282 } |
283 | 283 |
284 /////////////////////////////////////////////////////////////////////////////// | 284 /////////////////////////////////////////////////////////////////////////////// |
285 //PDF Support | 285 //PDF Support |
286 | 286 |
287 using namespace skia_advanced_typeface_metrics_utils; | |
288 | |
289 // Construct Glyph to Unicode table. | 287 // Construct Glyph to Unicode table. |
290 // Unicode code points that require conjugate pairs in utf16 are not | 288 // Unicode code points that require conjugate pairs in utf16 are not |
291 // supported. | 289 // supported. |
292 // TODO(bungeman): This never does what anyone wants. | 290 // TODO(bungeman): This never does what anyone wants. |
293 // What is really wanted is the text to glyphs mapping | 291 // What is really wanted is the text to glyphs mapping |
294 static void populate_glyph_to_unicode(IDWriteFontFace* fontFace, | 292 static void populate_glyph_to_unicode(IDWriteFontFace* fontFace, |
295 const unsigned glyphCount, | 293 const unsigned glyphCount, |
296 SkTDArray<SkUnichar>* glyphToUnicode) { | 294 SkTDArray<SkUnichar>* glyphToUnicode) { |
297 //Do this like free type instead | 295 //Do this like free type instead |
298 SkAutoTMalloc<SkUnichar> glyphToUni(glyphCount); | 296 SkAutoTMalloc<SkUnichar> glyphToUni(glyphCount); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 if (width > 0 && width < min_width) { | 435 if (width > 0 && width < min_width) { |
438 min_width = width; | 436 min_width = width; |
439 info->fStemV = min_width; | 437 info->fStemV = min_width; |
440 } | 438 } |
441 } | 439 } |
442 } | 440 } |
443 */ | 441 */ |
444 | 442 |
445 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { | 443 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { |
446 if (fixedWidth) { | 444 if (fixedWidth) { |
447 appendRange(&info->fGlyphWidths, 0); | 445 SkAdvancedTypefaceMetrics::WidthRange range(0); |
448 int16_t advance; | 446 int16_t advance; |
449 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); | 447 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); |
450 info->fGlyphWidths->fAdvance.append(1, &advance); | 448 range.fAdvance.append(1, &advance); |
451 finishRange(info->fGlyphWidths.get(), 0, | 449 SkAdvancedTypefaceMetrics::FinishRange( |
452 SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 450 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
| 451 info->fGlyphWidths.emplace_back(std::move(range)); |
453 } else { | 452 } else { |
454 info->fGlyphWidths.reset( | 453 info->setGlyphWidths(fDWriteFontFace.get(), glyphCount, glyphIDs, |
455 getAdvanceData(fDWriteFontFace.get(), | 454 glyphIDsCount, getWidthAdvance); |
456 glyphCount, | |
457 glyphIDs, | |
458 glyphIDsCount, | |
459 getWidthAdvance)); | |
460 } | 455 } |
461 } | 456 } |
462 | 457 |
463 return info; | 458 return info; |
464 } | 459 } |
465 #endif//defined(SK_BUILD_FOR_WIN32) | 460 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |