[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:23:28 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 6b9f1eec67bb22d16cd0f1c553627c147dd93e8b
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 7 17:46:53 2010 +0000
2010-10-05 Martin Robinson <mrobinson at igalia.com>
Reviewed by Chris Fleizach.
[Gtk] CSS font-style: italic behavior
https://bugs.webkit.org/show_bug.cgi?id=33299
Added a test to test the FontConfig synthetic oblique behavior.
* platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum: Added.
* platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png: Added.
* platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt: Added.
* platform/gtk/fonts/fontconfig-synthetic-oblique.html: Added.
2010-10-05 Martin Robinson <mrobinson at igalia.com>
Reviewed by Chris Fleizach.
[Gtk] CSS font-style: italic behavior
https://bugs.webkit.org/show_bug.cgi?id=33299
Properly interpret the FC_MATRIX property from a FontConfig pattern.
FontConfig will use this property when returning fonts which have a
synthetic oblique variant configured in the fonts.conf configuration
file.
Test: platform/gtk/fonts/fontconfig-synthetic-oblique.html
* platform/graphics/cairo/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::FontPlatformData): Added a constructor that
takes an existing FontPlatformData and a font size.
(WebCore::FontPlatformData::initializeWithFontFace): Added this helper
intialization method that properly handles the FC_MATRIX property from
the FcPattern.
* platform/graphics/cairo/FontPlatformDataFreeType.h: Added a declaration
to the new constructor and the initializeWithFontFace.
* platform/graphics/cairo/SimpleFontDataCairo.cpp:
(WebCore::SimpleFontData::smallCapsFontData): Use the new FontPlatformData
constructor.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e242f3d..a51b993 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-05 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Chris Fleizach.
+
+ [Gtk] CSS font-style: italic behavior
+ https://bugs.webkit.org/show_bug.cgi?id=33299
+
+ Added a test to test the FontConfig synthetic oblique behavior.
+
+ * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum: Added.
+ * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png: Added.
+ * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt: Added.
+ * platform/gtk/fonts/fontconfig-synthetic-oblique.html: Added.
+
2010-10-07 Albert J. Wong <ajwong at chromium.org>
Unreviewed. Chromium build fix.
diff --git a/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum
new file mode 100644
index 0000000..839a55d
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum
@@ -0,0 +1 @@
+3def390e078d3fa57473a2c5f03f28e7
\ No newline at end of file
diff --git a/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png
new file mode 100644
index 0000000..f803e15
Binary files /dev/null and b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png differ
diff --git a/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt
new file mode 100644
index 0000000..1647e7f
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock {P} at (0,0) size 784x19
+ RenderText {#text} at (0,0) size 228x19
+ text run at (0,0) width 228: "a b c d e f g h i j k l m n o p q r s t u v"
+ RenderBlock {P} at (0,35) size 784x19
+ RenderText {#text} at (0,0) size 241x19
+ text run at (0,0) width 241: "a b c d e f g h i j k l m n o p q r s t u v"
diff --git a/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique.html b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique.html
new file mode 100644
index 0000000..a86a084
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/fontconfig-synthetic-oblique.html
@@ -0,0 +1,17 @@
+<html>
+ <head>
+ <style type="text/css">
+ #notitalic {
+ font-family: "DejaVu Serif";
+ }
+ #italic {
+ font-family: "DejaVu Serif";
+ font-style: italic;
+ }
+ </style>
+ </head>
+ <body>
+ <p id="notitalic">a b c d e f g h i j k l m n o p q r s t u v</p>
+ <p id="italic">a b c d e f g h i j k l m n o p q r s t u v</p>
+ </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bf09c2d..555a8aa 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-05 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Chris Fleizach.
+
+ [Gtk] CSS font-style: italic behavior
+ https://bugs.webkit.org/show_bug.cgi?id=33299
+
+ Properly interpret the FC_MATRIX property from a FontConfig pattern.
+ FontConfig will use this property when returning fonts which have a
+ synthetic oblique variant configured in the fonts.conf configuration
+ file.
+
+ Test: platform/gtk/fonts/fontconfig-synthetic-oblique.html
+
+ * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
+ (WebCore::FontPlatformData::FontPlatformData): Added a constructor that
+ takes an existing FontPlatformData and a font size.
+ (WebCore::FontPlatformData::initializeWithFontFace): Added this helper
+ intialization method that properly handles the FC_MATRIX property from
+ the FcPattern.
+ * platform/graphics/cairo/FontPlatformDataFreeType.h: Added a declaration
+ to the new constructor and the initializeWithFontFace.
+ * platform/graphics/cairo/SimpleFontDataCairo.cpp:
+ (WebCore::SimpleFontData::smallCapsFontData): Use the new FontPlatformData
+ constructor.
+
2010-10-07 David Hyatt <hyatt at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
index 55fc9f3..90987c0 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
@@ -100,16 +100,8 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
, m_syntheticOblique(false)
, m_fixedWidth(false)
{
- cairo_font_options_t* options = cairo_font_options_create();
- setCairoFontOptionsFromFontConfigPattern(options, pattern);
-
- cairo_matrix_t fontMatrix;
- cairo_matrix_init_scale(&fontMatrix, m_size, m_size);
- cairo_matrix_t ctm;
- cairo_matrix_init_identity(&ctm);
-
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));
+ initializeWithFontFace(fontFace.get());
int spacing;
if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO)
@@ -123,6 +115,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
, m_syntheticOblique(italic)
, m_fixedWidth(false)
{
+ // We cannot create a scaled font here.
}
FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic)
@@ -131,24 +124,7 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
, m_syntheticBold(bold)
, m_syntheticOblique(italic)
{
- cairo_matrix_t fontMatrix;
- cairo_matrix_init_scale(&fontMatrix, size, size);
- cairo_matrix_t ctm;
- cairo_matrix_init_identity(&ctm);
- static const cairo_font_options_t* defaultOptions = cairo_font_options_create();
- const cairo_font_options_t* options = NULL;
-
-#if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT)
- if (GdkScreen* screen = gdk_screen_get_default())
- options = gdk_screen_get_font_options(screen);
-#endif
-
- // gdk_screen_get_font_options() returns NULL if no default options are
- // set, so we always have to check.
- if (!options)
- options = defaultOptions;
-
- m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
+ initializeWithFontFace(fontFace);
FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont.get());
if (fontConfigFace) {
@@ -185,6 +161,16 @@ FontPlatformData::FontPlatformData(const FontPlatformData& other)
*this = other;
}
+FontPlatformData::FontPlatformData(const FontPlatformData& other, float size)
+{
+ *this = other;
+
+ // We need to reinitialize the instance, because the difference in size
+ // necessitates a new scaled font instance.
+ m_size = size;
+ initializeWithFontFace(cairo_scaled_font_get_font_face(m_scaledFont.get()));
+}
+
FontPlatformData::~FontPlatformData()
{
if (m_fallbacks) {
@@ -214,4 +200,45 @@ String FontPlatformData::description() const
}
#endif
+void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
+{
+ cairo_font_options_t* options = 0;
+#if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT)
+ if (GdkScreen* screen = gdk_screen_get_default())
+ options = cairo_font_options_copy(gdk_screen_get_font_options(screen));
+#endif
+ // gdk_screen_get_font_options() returns null if no default
+ // options are set, so we always have to check.
+ if (!options)
+ options = cairo_font_options_create();
+
+ cairo_matrix_t ctm;
+ cairo_matrix_init_identity(&ctm);
+
+ cairo_matrix_t fontMatrix;
+ if (!m_pattern)
+ cairo_matrix_init_scale(&fontMatrix, m_size, m_size);
+ else {
+ setCairoFontOptionsFromFontConfigPattern(options, m_pattern.get());
+
+ // FontConfig may return a list of transformation matrices with the pattern, for instance,
+ // for fonts that are oblique. We use that to initialize the cairo font matrix.
+ FcMatrix fontConfigMatrix, *tempFontConfigMatrix;
+ FcMatrixInit(&fontConfigMatrix);
+
+ // These matrices may be stacked in the pattern, so it's our job to get them all and multiply them.
+ for (int i = 0; FcPatternGetMatrix(m_pattern.get(), FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++)
+ FcMatrixMultiply(&fontConfigMatrix, &fontConfigMatrix, tempFontConfigMatrix);
+ cairo_matrix_init(&fontMatrix, fontConfigMatrix.xx, -fontConfigMatrix.yx,
+ -fontConfigMatrix.xy, fontConfigMatrix.yy, 0, 0);
+
+ // The matrix from FontConfig does not include the scale.
+ cairo_matrix_scale(&fontMatrix, m_size, m_size);
+ }
+
+ m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
+ cairo_font_options_destroy(options);
+}
+
+
}
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
index ff5bc92..7d3ff99 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
@@ -57,6 +57,7 @@ public:
FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic);
FontPlatformData(float size, bool bold, bool italic);
FontPlatformData(const FontPlatformData&);
+ FontPlatformData(const FontPlatformData&, float size);
~FontPlatformData();
@@ -91,6 +92,9 @@ public:
bool m_syntheticOblique;
bool m_fixedWidth;
PlatformRefPtr<cairo_scaled_font_t> m_scaledFont;
+
+private:
+ void initializeWithFontFace(cairo_font_face_t*);
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list