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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm)
, | 281 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm)
, |
282 "Could not get design metrics."); | 282 "Could not get design metrics."); |
283 } | 283 } |
284 | 284 |
285 DWRITE_FONT_METRICS dwfm; | 285 DWRITE_FONT_METRICS dwfm; |
286 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); | 286 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); |
287 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure, | 287 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure, |
288 SkIntToScalar(gm.advanceWidth), | 288 SkIntToScalar(gm.advanceWidth), |
289 SkIntToScalar(dwfm.designUnitsPerEm)); | 289 SkIntToScalar(dwfm.designUnitsPerEm)); |
290 | 290 |
291 if (!this->isSubpixel()) { | |
292 advanceX = SkScalarRoundToScalar(advanceX); | |
293 } | |
294 | |
295 SkVector vecs[1] = { { advanceX, 0 } }; | 291 SkVector vecs[1] = { { advanceX, 0 } }; |
296 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode || | 292 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode || |
297 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode) | 293 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode) |
298 { | 294 { |
299 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); | 295 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); |
300 } else { | 296 } else { |
301 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); | 297 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); |
302 } | 298 } |
303 | 299 |
304 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); | 300 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 NULL, //advances | 610 NULL, //advances |
615 NULL, //offsets | 611 NULL, //offsets |
616 1, //num glyphs | 612 1, //num glyphs |
617 FALSE, //sideways | 613 FALSE, //sideways |
618 FALSE, //rtl | 614 FALSE, //rtl |
619 geometryToPath.get()), | 615 geometryToPath.get()), |
620 "Could not create glyph outline."); | 616 "Could not create glyph outline."); |
621 | 617 |
622 path->transform(fSkXform); | 618 path->transform(fSkXform); |
623 } | 619 } |
OLD | NEW |