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

Unified Diff: src/ports/SkFontMgr_win_dw.cpp

Issue 1107283003: Remove system call in DW for default font. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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
« gm/fontmgr.cpp ('K') | « gm/fontmgr.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_win_dw.cpp
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index b07a05091dd75132d5676e63e0662a952ab61c98..7245f52ce9a6cfa8e2bfd637cd2a8dfa0a2d844d 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -629,21 +629,6 @@ protected:
SkTypeface* fResolvedTypeface;
};
-static HRESULT getDefaultFontFamilyName(SkSMallocWCHAR* name) {
- NONCLIENTMETRICSW metrics;
- metrics.cbSize = sizeof(metrics);
- if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) {
- return E_UNEXPECTED;
- }
-
- size_t len = wcsnlen_s(metrics.lfMessageFont.lfFaceName, LF_FACESIZE) + 1;
- if (0 != wcsncpy_s(name->reset(len), len, metrics.lfMessageFont.lfFaceName, _TRUNCATE)) {
- return E_UNEXPECTED;
- }
-
- return S_OK;
-}
-
class FontFallbackSource : public IDWriteTextAnalysisSource {
public:
FontFallbackSource(const WCHAR* string, UINT32 length, const WCHAR* locale,
@@ -750,11 +735,11 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
{
const DWriteStyle dwStyle(style);
- SkSMallocWCHAR dwFamilyName;
- if (NULL == familyName) {
- HRN(getDefaultFontFamilyName(&dwFamilyName));
- } else {
- HRN(sk_cstring_to_wchar(familyName, &dwFamilyName));
+ const WCHAR* dwFamilyName = NULL;
+ SkSMallocWCHAR dwFamilyNameLocal;
+ if (familyName) {
+ HRN(sk_cstring_to_wchar(familyName, &dwFamilyNameLocal));
+ dwFamilyName = dwFamilyNameLocal;
}
WCHAR str[16];
@@ -816,7 +801,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
#endif
SkTScopedComPtr<IDWriteTextFormat> fallbackFormat;
- HRNM(fFactory->CreateTextFormat(dwFamilyName,
+ HRNM(fFactory->CreateTextFormat(dwFamilyName ? dwFamilyName : L"",
fFontCollection.get(),
dwStyle.fWeight,
dwStyle.fSlant,
« gm/fontmgr.cpp ('K') | « gm/fontmgr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698