summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/win/SimpleFontDataWin.cpp')
-rw-r--r--WebCore/platform/graphics/win/SimpleFontDataWin.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
index 6d1d777..60afe6a 100644
--- a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
+++ b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
@@ -110,24 +110,40 @@ void SimpleFontData::platformDestroy()
delete m_scriptFontProperties;
}
-SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
+SimpleFontData* SimpleFontData::scaledFontData(const FontDescription& fontDescription, float scaleFactor) const
{
- if (!m_smallCapsFontData) {
- float smallCapsHeight = cSmallCapsFontSizeMultiplier * m_platformData.size();
+ float scaledSize = scaleFactor * m_platformData.size();
if (isCustomFont()) {
- FontPlatformData smallCapsFontData(m_platformData);
- smallCapsFontData.setSize(smallCapsHeight);
- m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false);
- } else {
- LOGFONT winfont;
- GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont);
- winfont.lfHeight = -lroundf(smallCapsHeight * (m_platformData.useGDI() ? 1 : 32));
- HFONT hfont = CreateFontIndirect(&winfont);
- m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()),
- isCustomFont(), false);
+ FontPlatformData scaledFont(m_platformData);
+ scaledFont.setSize(scaledSize);
+ return new SimpleFontData(scaledFont, true, false);
}
- }
- return m_smallCapsFontData;
+
+ LOGFONT winfont;
+ GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont);
+ winfont.lfHeight = -lroundf(scaledSize * (m_platformData.useGDI() ? 1 : 32));
+ HFONT hfont = CreateFontIndirect(&winfont);
+ return new SimpleFontData(FontPlatformData(hfont, scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false);
+}
+
+SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
+{
+ if (!m_derivedFontData)
+ m_derivedFontData = DerivedFontData::create(isCustomFont());
+ if (!m_derivedFontData->smallCaps)
+ m_derivedFontData->smallCaps = scaledFontData(fontDescription, cSmallCapsFontSizeMultiplier);
+
+ return m_derivedFontData->smallCaps.get();
+}
+
+SimpleFontData* SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const
+{
+ if (!m_derivedFontData)
+ m_derivedFontData = DerivedFontData::create(isCustomFont());
+ if (!m_derivedFontData->emphasisMark)
+ m_derivedFontData->emphasisMark = scaledFontData(fontDescription, .5);
+
+ return m_derivedFontData->emphasisMark.get();
}
bool SimpleFontData::containsCharacters(const UChar* characters, int length) const