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

Unified Diff: src/ports/SkTypeface_win_dw.cpp

Issue 324403010: DirectWrite to use PostScript name for PDF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use family name instead. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkTypeface_win_dw.cpp
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 4937d3f1430a676a574596cff79adef6ab432f1f..9eace8b4a07e29581fb978b8d8a90c7e48266189 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -365,23 +365,18 @@ SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
info->fLastGlyphID = SkToU16(glyphCount - 1);
info->fStyle = 0;
-
+ // SkAdvancedTypefaceMetrics::fFontName is in theory supposed to be
+ // the PostScript name of the font. However, due to the way it is currently
+ // used, it must actually be a family name.
SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
- SkTScopedComPtr<IDWriteLocalizedStrings> faceNames;
hr = fDWriteFontFamily->GetFamilyNames(&familyNames);
- hr = fDWriteFont->GetFaceNames(&faceNames);
UINT32 familyNameLength;
hr = familyNames->GetStringLength(0, &familyNameLength);
- UINT32 faceNameLength;
- hr = faceNames->GetStringLength(0, &faceNameLength);
-
- UINT32 size = familyNameLength+1+faceNameLength+1;
+ UINT32 size = familyNameLength+1;
SkSMallocWCHAR wFamilyName(size);
hr = familyNames->GetString(0, wFamilyName.get(), size);
- wFamilyName[familyNameLength] = L' ';
- hr = faceNames->GetString(0, &wFamilyName[familyNameLength+1], size - faceNameLength + 1);
hr = sk_wchar_to_skstring(wFamilyName.get(), &info->fFontName);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698