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

Side by Side Diff: src/ports/SkTypeface_win_dw.cpp

Issue 1129283003: Make SkAdvancedTypefaceMetrics private. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « src/ports/SkTypeface_win_dw.h ('k') | no next file » | 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 * 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 // SkTypes will include Windows.h, which will pull in all of the GDI defines. 9 // SkTypes will include Windows.h, which will pull in all of the GDI defines.
10 // GDI #defines GetGlyphIndices to GetGlyphIndicesA or GetGlyphIndicesW, but 10 // GDI #defines GetGlyphIndices to GetGlyphIndicesA or GetGlyphIndicesW, but
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (FAILED(hr)) { 315 if (FAILED(hr)) {
316 *advance = 0; 316 *advance = 0;
317 return false; 317 return false;
318 } 318 }
319 319
320 *advance = gm.advanceWidth; 320 *advance = gm.advanceWidth;
321 return true; 321 return true;
322 } 322 }
323 323
324 SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics( 324 SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
325 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, 325 PerGlyphInfo perGlyphInfo,
326 const uint32_t* glyphIDs, 326 const uint32_t* glyphIDs,
327 uint32_t glyphIDsCount) const { 327 uint32_t glyphIDsCount) const {
328 328
329 SkAdvancedTypefaceMetrics* info = NULL; 329 SkAdvancedTypefaceMetrics* info = NULL;
330 330
331 HRESULT hr = S_OK; 331 HRESULT hr = S_OK;
332 332
333 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); 333 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount();
334 334
335 DWRITE_FONT_METRICS dwfm; 335 DWRITE_FONT_METRICS dwfm;
(...skipping 12 matching lines...) Expand all
348 hr = fDWriteFontFamily->GetFamilyNames(&familyNames); 348 hr = fDWriteFontFamily->GetFamilyNames(&familyNames);
349 349
350 UINT32 familyNameLen; 350 UINT32 familyNameLen;
351 hr = familyNames->GetStringLength(0, &familyNameLen); 351 hr = familyNames->GetStringLength(0, &familyNameLen);
352 352
353 SkSMallocWCHAR familyName(familyNameLen+1); 353 SkSMallocWCHAR familyName(familyNameLen+1);
354 hr = familyNames->GetString(0, familyName.get(), familyNameLen+1); 354 hr = familyNames->GetString(0, familyName.get(), familyNameLen+1);
355 355
356 hr = sk_wchar_to_skstring(familyName.get(), familyNameLen, &info->fFontName) ; 356 hr = sk_wchar_to_skstring(familyName.get(), familyNameLen, &info->fFontName) ;
357 357
358 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kToUnicode_PerGlyphInfo) { 358 if (perGlyphInfo & kToUnicode_PerGlyphInfo) {
359 populate_glyph_to_unicode(fDWriteFontFace.get(), glyphCount, &(info->fGl yphToUnicode)); 359 populate_glyph_to_unicode(fDWriteFontFace.get(), glyphCount, &(info->fGl yphToUnicode));
360 } 360 }
361 361
362 DWRITE_FONT_FACE_TYPE fontType = fDWriteFontFace->GetType(); 362 DWRITE_FONT_FACE_TYPE fontType = fDWriteFontFace->GetType();
363 if (fontType == DWRITE_FONT_FACE_TYPE_TRUETYPE || 363 if (fontType == DWRITE_FONT_FACE_TYPE_TRUETYPE ||
364 fontType == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) { 364 fontType == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) {
365 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font; 365 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
366 } else { 366 } else {
367 info->fType = SkAdvancedTypefaceMetrics::kOther_Font; 367 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
368 info->fItalicAngle = 0; 368 info->fItalicAngle = 0;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { 435 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
436 int16_t width = abcWidths.abcB; 436 int16_t width = abcWidths.abcB;
437 if (width > 0 && width < min_width) { 437 if (width > 0 && width < min_width) {
438 min_width = width; 438 min_width = width;
439 info->fStemV = min_width; 439 info->fStemV = min_width;
440 } 440 }
441 } 441 }
442 } 442 }
443 */ 443 */
444 444
445 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo) { 445 if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
446 if (fixedWidth) { 446 if (fixedWidth) {
447 appendRange(&info->fGlyphWidths, 0); 447 appendRange(&info->fGlyphWidths, 0);
448 int16_t advance; 448 int16_t advance;
449 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); 449 getWidthAdvance(fDWriteFontFace.get(), 1, &advance);
450 info->fGlyphWidths->fAdvance.append(1, &advance); 450 info->fGlyphWidths->fAdvance.append(1, &advance);
451 finishRange(info->fGlyphWidths.get(), 0, 451 finishRange(info->fGlyphWidths.get(), 0,
452 SkAdvancedTypefaceMetrics::WidthRange::kDefault); 452 SkAdvancedTypefaceMetrics::WidthRange::kDefault);
453 } else { 453 } else {
454 info->fGlyphWidths.reset( 454 info->fGlyphWidths.reset(
455 getAdvanceData(fDWriteFontFace.get(), 455 getAdvanceData(fDWriteFontFace.get(),
456 glyphCount, 456 glyphCount,
457 glyphIDs, 457 glyphIDs,
458 glyphIDsCount, 458 glyphIDsCount,
459 getWidthAdvance)); 459 getWidthAdvance));
460 } 460 }
461 } 461 }
462 462
463 return info; 463 return info;
464 } 464 }
OLDNEW
« no previous file with comments | « src/ports/SkTypeface_win_dw.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698