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

Unified Diff: Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp

Issue 23480016: Switch non-gdi windows font path to use new SkFontMgr (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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
Index: Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
diff --git a/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp b/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
index 0120b9ec0e8b4a687c3c74a7e1a91eb64607d8e0..3c882005775865ab6eb8cce92d0828741b363e8e 100644
--- a/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
+++ b/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
@@ -32,6 +32,8 @@
#include "config.h"
#include "core/platform/graphics/FontCache.h"
+#include "SkFontMgr.h"
+#include "SkTypeface_win.h"
#include "core/platform/NotImplemented.h"
#include "core/platform/graphics/Font.h"
#include "core/platform/graphics/SimpleFontData.h"
@@ -40,6 +42,18 @@
namespace WebCore {
+FontCache::FontCache()
+ : m_purgePreventCount(0)
+{
+ m_fontManager = SkFontMgr_New_GDI();
+}
+
+FontCache::~FontCache()
+{
+ m_fontManager->unref();
+}
+
+
static bool fontContainsCharacter(const FontPlatformData* fontData, const wchar_t* family, UChar32 character)
{
SkPaint paint;
@@ -168,7 +182,16 @@ static bool typefacesMatchesFamily(const SkTypeface* tf, const AtomicString& fam
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
{
CString name;
- SkTypeface* tf = createTypeface(fontDescription, family, name);
+ getFontNameIncludingFallback(fontDescription, family, name);
+
+ // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypeface.
+ int style = SkTypeface::kNormal;
+ if (fontDescription.weight() >= FontWeightBold)
+ style |= SkTypeface::kBold;
+ if (fontDescription.italic())
+ style |= SkTypeface::kItalic;
+
+ SkTypeface* tf = m_fontManager->legacyCreateTypeface(name.data(), style);
if (!tf)
return 0;

Powered by Google App Engine
This is Rietveld 408576698