Diff
Modified: trunk/Source/WebCore/ChangeLog (200093 => 200094)
--- trunk/Source/WebCore/ChangeLog 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/ChangeLog 2016-04-26 17:20:29 UTC (rev 200094)
@@ -1,3 +1,43 @@
+2016-04-26 Myles C. Maxfield <[email protected]>
+
+ Make FontPlatformData immutable
+ https://bugs.webkit.org/show_bug.cgi?id=157024
+
+ Reviewed by Darin Adler.
+
+ This patch deletes all functions which modify a FontPlatformData once
+ it has been created. This makes for a cleaner design.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::verticalRightOrientationFont):
+ (WebCore::Font::nonSyntheticItalicFont):
+ * platform/graphics/FontPlatformData.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+ (WebCore::FontPlatformData::cloneWithOrientation):
+ (WebCore::FontPlatformData::cloneWithSyntheticOblique):
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::setIsSystemFont): Deleted.
+ (WebCore::FontPlatformData::setSize): Deleted.
+ (WebCore::FontPlatformData::setOrientation): Deleted.
+ (WebCore::FontPlatformData::setSyntheticOblique): Deleted.
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters):
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::drawGlyphs):
+ * platform/graphics/cocoa/FontCocoa.mm:
+ (WebCore::Font::platformInit):
+ (WebCore::Font::platformCharWidthInit):
+ (WebCore::createDerivativeFont):
+ (WebCore::Font::createFontWithoutSynthesizableFeatures):
+ (WebCore::Font::platformCreateScaledFont):
+ (WebCore::Font::platformWidthForGlyph):
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::openTypeTable):
+ * platform/graphics/win/FontPlatformDataCairoWin.cpp:
+ (WebCore::FontPlatformData::platformDataInit):
+
2016-04-26 Ryan Haddad <[email protected]>
Unreviewed, rolling out r200089.
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -253,8 +253,7 @@
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
if (!m_derivedFontData->verticalRightOrientation) {
- FontPlatformData verticalRightPlatformData(m_platformData);
- verticalRightPlatformData.setOrientation(Horizontal);
+ auto verticalRightPlatformData = FontPlatformData::cloneWithOrientation(m_platformData, Horizontal);
m_derivedFontData->verticalRightOrientation = create(verticalRightPlatformData, isCustomFont(), false, true);
}
ASSERT(m_derivedFontData->verticalRightOrientation != this);
@@ -320,9 +319,10 @@
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
if (!m_derivedFontData->nonSyntheticItalic) {
+#if PLATFORM(COCOA) || USE(CAIRO)
+ FontPlatformData nonSyntheticItalicFontPlatformData = FontPlatformData::cloneWithSyntheticOblique(m_platformData, false);
+#else
FontPlatformData nonSyntheticItalicFontPlatformData(m_platformData);
-#if PLATFORM(COCOA) || USE(CAIRO)
- nonSyntheticItalicFontPlatformData.setSyntheticOblique(false);
#endif
m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont());
}
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -44,12 +44,12 @@
}
FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode)
- : m_syntheticBold(syntheticBold)
- , m_syntheticOblique(syntheticOblique)
+ : m_size(size)
, m_orientation(orientation)
- , m_size(size)
, m_widthVariant(widthVariant)
, m_textRenderingMode(textRenderingMode)
+ , m_syntheticBold(syntheticBold)
+ , m_syntheticOblique(syntheticOblique)
{
}
@@ -71,6 +71,27 @@
platformDataInit(source);
}
+FontPlatformData FontPlatformData::cloneWithOrientation(const FontPlatformData& source, FontOrientation orientation)
+{
+ FontPlatformData copy(source);
+ copy.m_orientation = orientation;
+ return copy;
+}
+
+FontPlatformData FontPlatformData::cloneWithSyntheticOblique(const FontPlatformData& source, bool syntheticOblique)
+{
+ FontPlatformData copy(source);
+ copy.m_syntheticOblique = syntheticOblique;
+ return copy;
+}
+
+FontPlatformData FontPlatformData::cloneWithSize(const FontPlatformData& source, float size)
+{
+ FontPlatformData copy(source);
+ copy.m_size = size;
+ return copy;
+}
+
const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
{
// Check for self-assignment.
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2016-04-26 17:20:29 UTC (rev 200094)
@@ -74,6 +74,7 @@
class FontDescription;
class SharedBuffer;
+// This class is conceptually immutable. Once created, no instances should ever change (in an observable way).
class FontPlatformData {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -87,6 +88,10 @@
WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, TextRenderingMode = AutoTextRendering);
#endif
+ static FontPlatformData cloneWithOrientation(const FontPlatformData&, FontOrientation);
+ static FontPlatformData cloneWithSyntheticOblique(const FontPlatformData&, bool);
+ static FontPlatformData cloneWithSize(const FontPlatformData&, float);
+
#if USE(CG)
FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant, TextRenderingMode);
#endif
@@ -124,7 +129,6 @@
#if PLATFORM(WIN) || PLATFORM(COCOA)
bool isSystemFont() const { return m_isSystemFont; }
- void setIsSystemFont(bool isSystemFont) { m_isSystemFont = isSystemFont; }
#endif
#if USE(CG)
@@ -133,7 +137,6 @@
bool isFixedPitch() const;
float size() const { return m_size; }
- void setSize(float size) { m_size = size; }
bool syntheticBold() const { return m_syntheticBold; }
bool syntheticOblique() const { return m_syntheticOblique; }
bool isColorBitmapFont() const { return m_isColorBitmapFont; }
@@ -142,9 +145,6 @@
TextRenderingMode textRenderingMode() const { return m_textRenderingMode; }
bool isForTextCombine() const { return widthVariant() != RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
- void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
- void setSyntheticOblique(bool syntheticOblique) { m_syntheticOblique = syntheticOblique; }
-
#if USE(CAIRO)
cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
#endif
@@ -197,7 +197,7 @@
}
#if PLATFORM(COCOA) || PLATFORM(WIN)
- PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
+ RefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
#endif
#ifndef NDEBUG
@@ -215,15 +215,6 @@
void platformDataInit(HFONT, float size, HDC, WCHAR* faceName);
#endif
-public:
- bool m_syntheticBold { false };
- bool m_syntheticOblique { false };
- FontOrientation m_orientation { Horizontal };
- float m_size { 0 };
- FontWidthVariant m_widthVariant { RegularWidth };
- TextRenderingMode m_textRenderingMode { AutoTextRendering };
-
-private:
#if PLATFORM(COCOA)
// FIXME: Get rid of one of these. These two fonts are subtly different, and it is not obvious which one to use where.
RetainPtr<CTFontRef> m_font;
@@ -239,9 +230,21 @@
cairo_scaled_font_t* m_scaledFont { nullptr };
#endif
+ // The values below are common to all ports
+ // FIXME: If they're common to all ports, they should move to Font
+ float m_size { 0 };
+
+ FontOrientation m_orientation { Horizontal };
+ FontWidthVariant m_widthVariant { RegularWidth };
+ TextRenderingMode m_textRenderingMode { AutoTextRendering };
+
+ bool m_syntheticBold { false };
+ bool m_syntheticOblique { false };
bool m_isColorBitmapFont { false };
bool m_isHashTableDeletedValue { false };
bool m_isSystemFont { false };
+ // The values above are common to all ports
+
#if PLATFORM(IOS)
bool m_isEmoji { false };
#endif
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -791,7 +791,7 @@
bool syntheticBold, syntheticOblique;
std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(substituteFont, description, isPlatformFont).boldObliquePair();
- FontPlatformData alternateFont(substituteFont, platformData.size(), syntheticBold, syntheticOblique, platformData.m_orientation, platformData.m_widthVariant, platformData.m_textRenderingMode);
+ FontPlatformData alternateFont(substituteFont, platformData.size(), syntheticBold, syntheticOblique, platformData.orientation(), platformData.widthVariant(), platformData.textRenderingMode());
return fontForPlatformData(alternateFont);
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2016-04-26 17:20:29 UTC (rev 200094)
@@ -280,7 +280,7 @@
matrix = CTFontGetMatrix(platformData.font());
matrix.b = -matrix.b;
matrix.d = -matrix.d;
- if (platformData.m_syntheticOblique) {
+ if (platformData.syntheticOblique()) {
static float obliqueSkew = tanf(SYNTHETIC_OBLIQUE_ANGLE * piFloat / 180);
if (platformData.orientation() == Vertical)
matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2016-04-26 17:20:29 UTC (rev 200094)
@@ -96,7 +96,7 @@
{
// FIXME: Unify these two codepaths
#if USE(APPKIT)
- m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f;
+ m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100
// Work around <rdar://problem/19433490>
@@ -109,7 +109,7 @@
// Some fonts erroneously specify a positive descender value. We follow Core Text in assuming that
// such fonts meant the same distance, but in the reverse direction.
- float pointSize = m_platformData.m_size;
+ float pointSize = m_platformData.size();
float ascent = scaleEmToUnits(CGFontGetAscent(m_platformData.cgFont()), unitsPerEm) * pointSize;
float descent = -scaleEmToUnits(-abs(CGFontGetDescent(m_platformData.cgFont())), unitsPerEm) * pointSize;
float capHeight = scaleEmToUnits(CGFontGetCapHeight(m_platformData.cgFont()), unitsPerEm) * pointSize;
@@ -174,7 +174,7 @@
#else
- m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size() / 24.0f) : 0.f;
+ m_syntheticBoldOffset = m_platformData.syntheticBold() ? ceilf(m_platformData.size() / 24.0f) : 0.f;
CTFontRef ctFont = m_platformData.font();
FontServicesIOS fontService(ctFont);
@@ -202,7 +202,7 @@
if (os2Table && CFDataGetLength(os2Table.get()) >= 4) {
const UInt8* os2 = CFDataGetBytePtr(os2Table.get());
SInt16 os2AvgCharWidth = os2[2] * 256 + os2[3];
- m_avgCharWidth = scaleEmToUnits(os2AvgCharWidth, m_fontMetrics.unitsPerEm()) * m_platformData.m_size;
+ m_avgCharWidth = scaleEmToUnits(os2AvgCharWidth, m_fontMetrics.unitsPerEm()) * m_platformData.size();
}
RetainPtr<CFDataRef> headTable = adoptCF(CGFontCopyTableForTag(m_platformData.cgFont(), 'head'));
@@ -213,7 +213,7 @@
SInt16 xMin = static_cast<SInt16>(uxMin);
SInt16 xMax = static_cast<SInt16>(uxMax);
float diff = static_cast<float>(xMax - xMin);
- m_maxCharWidth = scaleEmToUnits(diff, m_fontMetrics.unitsPerEm()) * m_platformData.m_size;
+ m_maxCharWidth = scaleEmToUnits(diff, m_fontMetrics.unitsPerEm()) * m_platformData.size();
}
#endif
@@ -363,17 +363,17 @@
if (!font)
return nullptr;
- FontPlatformData scaledFontData(font, size, false, false, orientation);
-
if (syntheticBold)
fontTraits |= kCTFontBoldTrait;
if (syntheticItalic)
fontTraits |= kCTFontItalicTrait;
- CTFontSymbolicTraits scaledFontTraits = CTFontGetSymbolicTraits(scaledFontData.font());
- scaledFontData.m_syntheticBold = (fontTraits & kCTFontBoldTrait) && !(scaledFontTraits & kCTFontTraitBold);
- scaledFontData.m_syntheticOblique = (fontTraits & kCTFontItalicTrait) && !(scaledFontTraits & kCTFontTraitItalic);
+ CTFontSymbolicTraits scaledFontTraits = CTFontGetSymbolicTraits(font);
+ bool usedSyntheticBold = (fontTraits & kCTFontBoldTrait) && !(scaledFontTraits & kCTFontTraitBold);
+ bool usedSyntheticOblique = (fontTraits & kCTFontItalicTrait) && !(scaledFontTraits & kCTFontTraitItalic);
+ FontPlatformData scaledFontData(font, size, usedSyntheticBold, usedSyntheticOblique, orientation);
+
return Font::create(scaledFontData);
}
@@ -512,7 +512,7 @@
float size = m_platformData.size();
CTFontSymbolicTraits fontTraits = CTFontGetSymbolicTraits(m_platformData.font());
RetainPtr<CTFontRef> ctFont = createCTFontWithoutSynthesizableFeatures(m_platformData.font());
- return createDerivativeFont(ctFont.get(), size, m_platformData.orientation(), fontTraits, m_platformData.m_syntheticBold, m_platformData.m_syntheticOblique);
+ return createDerivativeFont(ctFont.get(), size, m_platformData.orientation(), fontTraits, m_platformData.syntheticBold(), m_platformData.syntheticOblique());
}
RefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
@@ -522,7 +522,7 @@
RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontCopyFontDescriptor(m_platformData.font()));
RetainPtr<CTFontRef> scaledFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
- return createDerivativeFont(scaledFont.get(), size, m_platformData.orientation(), fontTraits, m_platformData.m_syntheticBold, m_platformData.m_syntheticOblique);
+ return createDerivativeFont(scaledFont.get(), size, m_platformData.orientation(), fontTraits, m_platformData.syntheticBold(), m_platformData.syntheticOblique());
}
void Font::determinePitch()
@@ -628,14 +628,14 @@
bool horizontal = platformData().orientation() == Horizontal;
bool populatedAdvance = false;
if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) {
- float pointSize = platformData().m_size;
+ float pointSize = platformData().size();
CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, renderingStyle(platformData()), &glyph, 1, &advance)) {
RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont()));
LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize);
advance.width = 0;
}
- } else if (!populatedAdvance && platformData().m_size)
+ } else if (!populatedAdvance && platformData().size())
CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
return advance.width + m_syntheticBoldOffset;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2016-04-26 17:20:29 UTC (rev 200094)
@@ -188,7 +188,7 @@
return objectForEqualityCheck(ctFont());
}
-PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
{
if (RetainPtr<CFDataRef> data = "" table)))
return SharedBuffer::wrapCFData(data.get());
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2016-04-26 17:20:29 UTC (rev 200094)
@@ -68,6 +68,10 @@
FontPlatformData(const FontPlatformData&);
FontPlatformData(const FontPlatformData&, float size);
+ static FontPlatformData cloneWithOrientation(const FontPlatformData&, FontOrientation);
+ static FontPlatformData cloneWithSyntheticOblique(const FontPlatformData&, bool);
+ static FontPlatformData cloneWithSize(const FontPlatformData&, float);
+
~FontPlatformData();
HarfBuzzFace* harfBuzzFace() const;
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -265,6 +265,27 @@
cairo_scaled_font_destroy(m_scaledFont);
}
+FontPlatformData FontPlatformData::cloneWithOrientation(const FontPlatformData& source, FontOrientation orientation)
+{
+ FontPlatformData copy(source);
+ copy.m_orientation = orientation;
+ return copy;
+}
+
+FontPlatformData FontPlatformData::cloneWithSyntheticOblique(const FontPlatformData& source, bool syntheticOblique)
+{
+ FontPlatformData copy(source);
+ copy.m_syntheticOblique = syntheticOblique;
+ return copy;
+}
+
+FontPlatformData FontPlatformData::cloneWithSize(const FontPlatformData& source, float size)
+{
+ FontPlatformData copy(source);
+ copy.m_size = size;
+ return copy;
+}
+
HarfBuzzFace* FontPlatformData::harfBuzzFace() const
{
if (!m_harfBuzzFace)
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -46,7 +46,7 @@
cairo_matrix_init_identity(&ctm);
cairo_matrix_init_scale(&sizeMatrix, size, size);
- static cairo_font_options_t* fontOptions = 0;
+ static cairo_font_options_t* fontOptions = nullptr;
if (!fontOptions) {
fontOptions = cairo_font_options_create();
cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_SUBPIXEL);
@@ -101,7 +101,7 @@
{
m_font = source.m_font;
m_useGDI = source.m_useGDI;
- m_scaledFont = 0;
+ m_scaledFont = nullptr;
if (source.m_scaledFont)
m_scaledFont = cairo_scaled_font_reference(source.m_scaledFont);
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -74,7 +74,7 @@
RestoreDC(hdc, -1);
}
-PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
{
HWndDC hdc(0);
HGDIOBJ oldFont = SelectObject(hdc, hfont());
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (200093 => 200094)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2016-04-26 17:17:46 UTC (rev 200093)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2016-04-26 17:20:29 UTC (rev 200094)
@@ -135,11 +135,8 @@
RefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
{
float scaledSize = scaleFactor * m_platformData.size();
- if (isCustomFont()) {
- FontPlatformData scaledFont(m_platformData);
- scaledFont.setSize(scaledSize);
- return Font::create(scaledFont, true, false);
- }
+ if (isCustomFont())
+ return Font::create(FontPlatformData::cloneWithSize(m_platformData, scaledSize), true, false);
LOGFONT winfont;
GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont);