[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 14:14:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 61b060c8336d95d22ffa0c7b8972772a0fade752
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 5 20:09:25 2010 +0000

    2010-10-05  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Support FontPlatformData::isFixedPitch for custom fonts
            https://bugs.webkit.org/show_bug.cgi?id=47124
    
            Instead of determining whether or not a font is a fixed-width font
            lazily, do it up front. For fonts not backed by Fontconfig patterns,
            fetch information about whether or not the font is fixed-width from
            the FreeType face.
    
            No new tests as this should not change functionality.
    
            * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
            (WebCore::FontPlatformData::FontPlatformData): Initialize the m_fixedWidth member
            from the Fontconfig pattern or the FreeType face.
            (WebCore::FontPlatformData::operator=): Copy over the m_fixedWidth member.
            (WebCore::FontPlatformData::isFixedPitch): Just return the value of the m_fixedWidth member.
            * platform/graphics/cairo/FontPlatformDataFreeType.h: Added an m_fixedWidth member.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69137 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a7f5f81..09e96e9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-05  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] Support FontPlatformData::isFixedPitch for custom fonts
+        https://bugs.webkit.org/show_bug.cgi?id=47124
+
+        Instead of determining whether or not a font is a fixed-width font
+        lazily, do it up front. For fonts not backed by Fontconfig patterns,
+        fetch information about whether or not the font is fixed-width from
+        the FreeType face.
+
+        No new tests as this should not change functionality.
+
+        * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::FontPlatformData): Initialize the m_fixedWidth member
+        from the Fontconfig pattern or the FreeType face.
+        (WebCore::FontPlatformData::operator=): Copy over the m_fixedWidth member.
+        (WebCore::FontPlatformData::isFixedPitch): Just return the value of the m_fixedWidth member.
+        * platform/graphics/cairo/FontPlatformDataFreeType.h: Added an m_fixedWidth member.
+
 2010-10-05  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
index 0617e6c..55fc9f3 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
@@ -98,6 +98,7 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
     , m_size(fontDescription.computedPixelSize())
     , m_syntheticBold(false)
     , m_syntheticOblique(false)
+    , m_fixedWidth(false)
 {
     cairo_font_options_t* options = cairo_font_options_create();
     setCairoFontOptionsFromFontConfigPattern(options, pattern);
@@ -109,6 +110,10 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
 
     PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get()));
     m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace.get(), &fontMatrix, &ctm, options));
+
+    int spacing;
+    if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO)
+        m_fixedWidth = true;
 }
 
 FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
@@ -116,6 +121,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
     , m_size(size)
     , m_syntheticBold(bold)
     , m_syntheticOblique(italic)
+    , m_fixedWidth(false)
 {
 }
 
@@ -143,6 +149,12 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
         options = defaultOptions;
 
     m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
+
+    FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont.get());
+    if (fontConfigFace) {
+        m_fixedWidth = fontConfigFace->face_flags && FT_FACE_FLAG_FIXED_WIDTH;
+        cairo_ft_scaled_font_unlock_face(m_scaledFont.get());
+    }
 }
 
 FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
@@ -154,6 +166,7 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
     m_size = other.m_size;
     m_syntheticBold = other.m_syntheticBold;
     m_syntheticOblique = other.m_syntheticOblique;
+    m_fixedWidth = other.m_fixedWidth;
     m_scaledFont = other.m_scaledFont;
     m_pattern = other.m_pattern;
 
@@ -182,14 +195,7 @@ FontPlatformData::~FontPlatformData()
 
 bool FontPlatformData::isFixedPitch()
 {
-    // TODO: Support isFixedPitch() for custom fonts.
-    if (!m_pattern)
-        return false;
-
-    int spacing;
-    if (FcPatternGetInteger(m_pattern.get(), FC_SPACING, 0, &spacing) == FcResultMatch)
-        return spacing == FC_MONO;
-    return false;
+    return m_fixedWidth;
 }
 
 bool FontPlatformData::operator==(const FontPlatformData& other) const
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
index f3488ef..ff5bc92 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
@@ -89,6 +89,7 @@ public:
     float m_size;
     bool m_syntheticBold;
     bool m_syntheticOblique;
+    bool m_fixedWidth;
     PlatformRefPtr<cairo_scaled_font_t> m_scaledFont;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list