summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp')
-rw-r--r--Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
index c95d1b3b9..a2d591ba7 100644
--- a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
+++ b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
@@ -130,9 +130,14 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
if (fontDescription.weight() >= FontWeightBold) {
// The FC_EMBOLDEN property instructs us to fake the boldness of the font.
- FcBool fontConfigEmbolden;
+ FcBool fontConfigEmbolden = FcFalse;
if (FcPatternGetBool(pattern, FC_EMBOLDEN, 0, &fontConfigEmbolden) == FcResultMatch)
m_syntheticBold = fontConfigEmbolden;
+
+ // Fallback fonts may not have FC_EMBOLDEN activated even though it's necessary.
+ int weight = 0;
+ if (!m_syntheticBold && FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) == FcResultMatch)
+ m_syntheticBold = m_syntheticBold || weight < FC_WEIGHT_DEMIBOLD;
}
}
@@ -186,9 +191,7 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
cairo_scaled_font_destroy(m_scaledFont);
m_scaledFont = cairo_scaled_font_reference(other.m_scaledFont);
-#if USE(HARFBUZZ_NG)
- m_harfbuzzFace = other.m_harfbuzzFace;
-#endif
+ m_harfBuzzFace = other.m_harfBuzzFace;
return *this;
}
@@ -196,17 +199,13 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
FontPlatformData::FontPlatformData(const FontPlatformData& other)
: m_fallbacks(0)
, m_scaledFont(0)
-#if USE(HARFBUZZ_NG)
- , m_harfbuzzFace(other.m_harfbuzzFace)
-#endif
+ , m_harfBuzzFace(other.m_harfBuzzFace)
{
*this = other;
}
FontPlatformData::FontPlatformData(const FontPlatformData& other, float size)
-#if USE(HARFBUZZ_NG)
- : m_harfbuzzFace(other.m_harfbuzzFace)
-#endif
+ : m_harfBuzzFace(other.m_harfBuzzFace)
{
*this = other;
@@ -227,15 +226,13 @@ FontPlatformData::~FontPlatformData()
cairo_scaled_font_destroy(m_scaledFont);
}
-#if USE(HARFBUZZ_NG)
-HarfBuzzNGFace* FontPlatformData::harfbuzzFace() const
+HarfBuzzFace* FontPlatformData::harfBuzzFace() const
{
- if (!m_harfbuzzFace)
- m_harfbuzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), hash());
+ if (!m_harfBuzzFace)
+ m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), hash());
- return m_harfbuzzFace.get();
+ return m_harfBuzzFace.get();
}
-#endif
bool FontPlatformData::isFixedPitch()
{
@@ -244,8 +241,13 @@ bool FontPlatformData::isFixedPitch()
bool FontPlatformData::operator==(const FontPlatformData& other) const
{
- return m_pattern == other.m_pattern
- && m_scaledFont == other.m_scaledFont
+ // FcPatternEqual does not support null pointers as arguments.
+ if ((m_pattern && !other.m_pattern)
+ || (!m_pattern && other.m_pattern)
+ || (m_pattern != other.m_pattern && !FcPatternEqual(m_pattern.get(), other.m_pattern.get())))
+ return false;
+
+ return m_scaledFont == other.m_scaledFont
&& m_size == other.m_size
&& m_syntheticOblique == other.m_syntheticOblique
&& m_syntheticBold == other.m_syntheticBold;