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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 if (0 < glyph) { | 307 if (0 < glyph) { |
308 maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph); | 308 maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph); |
309 glyphToUni[glyph] = c; | 309 glyphToUni[glyph] = c; |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 SkTDArray<SkUnichar>(glyphToUni, maxGlyph + 1).swap(*glyphToUnicode); | 313 SkTDArray<SkUnichar>(glyphToUni, maxGlyph + 1).swap(*glyphToUnicode); |
314 } | 314 } |
315 | 315 |
316 static bool getWidthAdvance(IDWriteFontFace* fontFace, int gId, int16_t* advance
) { | |
317 SkASSERT(advance); | |
318 | |
319 UINT16 glyphId = gId; | |
320 DWRITE_GLYPH_METRICS gm; | |
321 HRESULT hr = fontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm); | |
322 | |
323 if (FAILED(hr)) { | |
324 *advance = 0; | |
325 return false; | |
326 } | |
327 | |
328 *advance = gm.advanceWidth; | |
329 return true; | |
330 } | |
331 | |
332 SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics( | 316 SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics( |
333 PerGlyphInfo perGlyphInfo, | 317 PerGlyphInfo perGlyphInfo, |
334 const uint32_t* glyphIDs, | 318 const uint32_t* glyphIDs, |
335 uint32_t glyphIDsCount) const { | 319 uint32_t glyphIDsCount) const { |
336 | 320 |
337 SkAdvancedTypefaceMetrics* info = nullptr; | 321 SkAdvancedTypefaceMetrics* info = nullptr; |
338 | 322 |
339 HRESULT hr = S_OK; | 323 HRESULT hr = S_OK; |
340 | 324 |
341 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); | 325 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 info->fDescent = SkToS16(dwfm.descent); | 399 info->fDescent = SkToS16(dwfm.descent); |
416 info->fCapHeight = SkToS16(dwfm.capHeight); | 400 info->fCapHeight = SkToS16(dwfm.capHeight); |
417 | 401 |
418 info->fBBox = SkIRect::MakeLTRB((int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->xMin), | 402 info->fBBox = SkIRect::MakeLTRB((int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->xMin), |
419 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->yMax), | 403 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->yMax), |
420 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->xMax), | 404 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->xMax), |
421 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->yMin)); | 405 (int32_t)SkEndian_SwapBE16((uint16_t)headTab
le->yMin)); |
422 return info; | 406 return info; |
423 } | 407 } |
424 #endif//defined(SK_BUILD_FOR_WIN32) | 408 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |