Chromium Code Reviews| Index: Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp |
| diff --git a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp |
| index 91a37d31ddbe24f504aab22c2152651adc733de1..40143c585cd26c530d253f2ca8a6fc963b472387 100644 |
| --- a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp |
| +++ b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp |
| @@ -53,7 +53,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const |
| { |
| const float ts = m_size >= 0 ? m_size : 12; |
| paint->setTextSize(SkFloatToScalar(m_size)); |
| - paint->setTypeface(m_typeface); |
| + paint->setTypeface(typeface()); |
| } |
| #endif |
| @@ -154,6 +154,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique) |
| , m_size(size) |
| , m_orientation(Horizontal) |
| , m_scriptCache(0) |
| + , m_typeface(0) |
| , m_paintTextFlags(0) |
| , m_isHashTableDeletedValue(false) |
| { |
| @@ -181,6 +182,24 @@ FontPlatformData::FontPlatformData(const FontPlatformData& data, float textSize) |
| { |
| } |
| +FontPlatformData::FontPlatformData(SkTypeface* tf, const char* family, float textSize, bool fakeBold, bool fakeItalic, FontOrientation orientation) |
| + : m_font(0) |
| + , m_size(textSize) |
| + , m_orientation(orientation) |
| + , m_scriptCache(0) |
| + , m_typeface(tf) |
| + , m_isHashTableDeletedValue(false) |
| +{ |
| + // FIXME: This can be removed together with m_font once the last few |
| + // uses of hfont() has been eliminated. |
| + LOGFONT logFont; |
| + SkLOGFONTFromTypeface(tf, &logFont); |
| + HFONT hFont = CreateFontIndirect(&logFont); |
|
bungeman-chromium
2013/08/15 22:24:44
When Skia hands back the logFont here, I don't thi
eae
2013/08/15 22:34:50
Ah, that likely explains my font-sizing problems.
|
| + if (hFont) |
| + m_font = RefCountedHFONT::create(hFont); |
| + m_paintTextFlags = computePaintTextFlags(logFont); |
| +} |
| + |
| FontPlatformData& FontPlatformData::operator=(const FontPlatformData& data) |
| { |
| if (this != &data) { |
| @@ -230,7 +249,7 @@ bool FontPlatformData::isFixedPitch() const |
| return treatAsFixedPitch; |
| #else |
| - return typeface()->isFixedPitch(); |
| + return typeface() && typeface()->isFixedPitch(); |
| #endif |
| } |