summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/pango/SimpleFontDataPango.cpp')
-rw-r--r--WebCore/platform/graphics/pango/SimpleFontDataPango.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp b/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
index bdfe237..d0bf836 100644
--- a/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
+++ b/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
@@ -76,19 +76,34 @@ void SimpleFontData::platformCharWidthInit()
void SimpleFontData::platformDestroy()
{
- delete m_smallCapsFontData;
- m_smallCapsFontData = 0;
+}
+
+SimpleFontData* SimpleFontData::scaledFontData(const FontDescription& fontDescription, float scaleFactor) const
+{
+ FontDescription desc = FontDescription(fontDescription);
+ desc.setSpecifiedSize(scaleFactor * fontDescription.computedSize());
+ FontPlatformData platformData(desc, desc.family().family());
+ return new SimpleFontData(platformData);
}
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
{
- if (!m_smallCapsFontData) {
- FontDescription desc = FontDescription(fontDescription);
- desc.setSpecifiedSize(0.70f * fontDescription.computedSize());
- FontPlatformData platformData(desc, desc.family().family());
- m_smallCapsFontData = new SimpleFontData(platformData);
- }
- return m_smallCapsFontData;
+ if (!m_derivedFontData)
+ m_derivedFontData = DerivedFontData::create(isCustomFont());
+ if (!m_derivedFontData->smallCaps)
+ m_derivedFontData->smallCaps = scaledFontData(fontDescription, .7);
+
+ 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