OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #undef GetGlyphIndices | 9 #undef GetGlyphIndices |
10 | 10 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); | 392 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); |
393 } else { | 393 } else { |
394 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); | 394 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); |
395 } | 395 } |
396 | 396 |
397 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); | 397 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); |
398 glyph->fAdvanceY = SkScalarToFixed(vecs[0].fY); | 398 glyph->fAdvanceY = SkScalarToFixed(vecs[0].fY); |
399 } | 399 } |
400 | 400 |
401 void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) { | 401 void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) { |
| 402 try_again: |
402 glyph->fWidth = 0; | 403 glyph->fWidth = 0; |
403 | 404 |
404 this->generateAdvance(glyph); | 405 this->generateAdvance(glyph); |
405 | 406 |
406 //Measure raster size. | 407 //Measure raster size. |
407 fXform.dx = SkFixedToFloat(glyph->getSubXFixed()); | 408 fXform.dx = SkFixedToFloat(glyph->getSubXFixed()); |
408 fXform.dy = SkFixedToFloat(glyph->getSubYFixed()); | 409 fXform.dy = SkFixedToFloat(glyph->getSubYFixed()); |
409 | 410 |
410 FLOAT advance = 0; | 411 FLOAT advance = 0; |
411 | 412 |
(...skipping 21 matching lines...) Expand all Loading... |
433 fRenderingMode, | 434 fRenderingMode, |
434 fMeasuringMode, | 435 fMeasuringMode, |
435 0.0f, // baselineOriginX, | 436 0.0f, // baselineOriginX, |
436 0.0f, // baselineOriginY, | 437 0.0f, // baselineOriginY, |
437 &glyphRunAnalysis), | 438 &glyphRunAnalysis), |
438 "Could not create glyph run analysis."); | 439 "Could not create glyph run analysis."); |
439 | 440 |
440 RECT bbox; | 441 RECT bbox; |
441 HRVM(glyphRunAnalysis->GetAlphaTextureBounds(fTextureType, &bbox), | 442 HRVM(glyphRunAnalysis->GetAlphaTextureBounds(fTextureType, &bbox), |
442 "Could not get texture bounds."); | 443 "Could not get texture bounds."); |
| 444 if (bbox.right == 0 && bbox.left == 0 && bbox.top == 0 && bbox.bottom == 0 &
& |
| 445 fTextureType == DWRITE_TEXTURE_CLEARTYPE_3x1) { |
| 446 fTextureType = DWRITE_TEXTURE_ALIASED_1x1; |
| 447 fRenderingMode = DWRITE_RENDERING_MODE_ALIASED; |
| 448 goto try_again; |
| 449 } |
443 | 450 |
444 glyph->fWidth = SkToU16(bbox.right - bbox.left); | 451 glyph->fWidth = SkToU16(bbox.right - bbox.left); |
445 glyph->fHeight = SkToU16(bbox.bottom - bbox.top); | 452 glyph->fHeight = SkToU16(bbox.bottom - bbox.top); |
446 glyph->fLeft = SkToS16(bbox.left); | 453 glyph->fLeft = SkToS16(bbox.left); |
447 glyph->fTop = SkToS16(bbox.top); | 454 glyph->fTop = SkToS16(bbox.top); |
448 } | 455 } |
449 | 456 |
450 void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) { | 457 void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) { |
451 if (NULL == metrics) { | 458 if (NULL == metrics) { |
452 return; | 459 return; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 NULL, //advances | 719 NULL, //advances |
713 NULL, //offsets | 720 NULL, //offsets |
714 1, //num glyphs | 721 1, //num glyphs |
715 FALSE, //sideways | 722 FALSE, //sideways |
716 FALSE, //rtl | 723 FALSE, //rtl |
717 geometryToPath.get()), | 724 geometryToPath.get()), |
718 "Could not create glyph outline."); | 725 "Could not create glyph outline."); |
719 | 726 |
720 path->transform(fSkXform); | 727 path->transform(fSkXform); |
721 } | 728 } |
OLD | NEW |