Changeset 69320 in webkit
- Timestamp:
- Oct 7, 2010 10:46:53 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r69314 r69320 1 2010-10-05 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Chris Fleizach. 4 5 [Gtk] CSS font-style: italic behavior 6 https://bugs.webkit.org/show_bug.cgi?id=33299 7 8 Added a test to test the FontConfig synthetic oblique behavior. 9 10 * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.checksum: Added. 11 * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.png: Added. 12 * platform/gtk/fonts/fontconfig-synthetic-oblique-expected.txt: Added. 13 * platform/gtk/fonts/fontconfig-synthetic-oblique.html: Added. 14 1 15 2010-10-07 Albert J. Wong <ajwong@chromium.org> 2 16 -
trunk/WebCore/ChangeLog
r69319 r69320 1 2010-10-05 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Chris Fleizach. 4 5 [Gtk] CSS font-style: italic behavior 6 https://bugs.webkit.org/show_bug.cgi?id=33299 7 8 Properly interpret the FC_MATRIX property from a FontConfig pattern. 9 FontConfig will use this property when returning fonts which have a 10 synthetic oblique variant configured in the fonts.conf configuration 11 file. 12 13 Test: platform/gtk/fonts/fontconfig-synthetic-oblique.html 14 15 * platform/graphics/cairo/FontPlatformDataFreeType.cpp: 16 (WebCore::FontPlatformData::FontPlatformData): Added a constructor that 17 takes an existing FontPlatformData and a font size. 18 (WebCore::FontPlatformData::initializeWithFontFace): Added this helper 19 intialization method that properly handles the FC_MATRIX property from 20 the FcPattern. 21 * platform/graphics/cairo/FontPlatformDataFreeType.h: Added a declaration 22 to the new constructor and the initializeWithFontFace. 23 * platform/graphics/cairo/SimpleFontDataCairo.cpp: 24 (WebCore::SimpleFontData::smallCapsFontData): Use the new FontPlatformData 25 constructor. 26 1 27 2010-10-07 David Hyatt <hyatt@apple.com> 2 28 -
trunk/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
r69137 r69320 101 101 , m_fixedWidth(false) 102 102 { 103 cairo_font_options_t* options = cairo_font_options_create();104 setCairoFontOptionsFromFontConfigPattern(options, pattern);105 106 cairo_matrix_t fontMatrix;107 cairo_matrix_init_scale(&fontMatrix, m_size, m_size);108 cairo_matrix_t ctm;109 cairo_matrix_init_identity(&ctm);110 111 103 PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get())); 112 m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace.get(), &fontMatrix, &ctm, options));104 initializeWithFontFace(fontFace.get()); 113 105 114 106 int spacing; … … 124 116 , m_fixedWidth(false) 125 117 { 118 // We cannot create a scaled font here. 126 119 } 127 120 … … 132 125 , m_syntheticOblique(italic) 133 126 { 134 cairo_matrix_t fontMatrix; 135 cairo_matrix_init_scale(&fontMatrix, size, size); 136 cairo_matrix_t ctm; 137 cairo_matrix_init_identity(&ctm); 138 static const cairo_font_options_t* defaultOptions = cairo_font_options_create(); 139 const cairo_font_options_t* options = NULL; 140 141 #if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT) 142 if (GdkScreen* screen = gdk_screen_get_default()) 143 options = gdk_screen_get_font_options(screen); 144 #endif 145 146 // gdk_screen_get_font_options() returns NULL if no default options are 147 // set, so we always have to check. 148 if (!options) 149 options = defaultOptions; 150 151 m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options)); 127 initializeWithFontFace(fontFace); 152 128 153 129 FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont.get()); … … 186 162 } 187 163 164 FontPlatformData::FontPlatformData(const FontPlatformData& other, float size) 165 { 166 *this = other; 167 168 // We need to reinitialize the instance, because the difference in size 169 // necessitates a new scaled font instance. 170 m_size = size; 171 initializeWithFontFace(cairo_scaled_font_get_font_face(m_scaledFont.get())); 172 } 173 188 174 FontPlatformData::~FontPlatformData() 189 175 { … … 215 201 #endif 216 202 217 } 203 void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace) 204 { 205 cairo_font_options_t* options = 0; 206 #if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT) 207 if (GdkScreen* screen = gdk_screen_get_default()) 208 options = cairo_font_options_copy(gdk_screen_get_font_options(screen)); 209 #endif 210 // gdk_screen_get_font_options() returns null if no default 211 // options are set, so we always have to check. 212 if (!options) 213 options = cairo_font_options_create(); 214 215 cairo_matrix_t ctm; 216 cairo_matrix_init_identity(&ctm); 217 218 cairo_matrix_t fontMatrix; 219 if (!m_pattern) 220 cairo_matrix_init_scale(&fontMatrix, m_size, m_size); 221 else { 222 setCairoFontOptionsFromFontConfigPattern(options, m_pattern.get()); 223 224 // FontConfig may return a list of transformation matrices with the pattern, for instance, 225 // for fonts that are oblique. We use that to initialize the cairo font matrix. 226 FcMatrix fontConfigMatrix, *tempFontConfigMatrix; 227 FcMatrixInit(&fontConfigMatrix); 228 229 // These matrices may be stacked in the pattern, so it's our job to get them all and multiply them. 230 for (int i = 0; FcPatternGetMatrix(m_pattern.get(), FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++) 231 FcMatrixMultiply(&fontConfigMatrix, &fontConfigMatrix, tempFontConfigMatrix); 232 cairo_matrix_init(&fontMatrix, fontConfigMatrix.xx, -fontConfigMatrix.yx, 233 -fontConfigMatrix.xy, fontConfigMatrix.yy, 0, 0); 234 235 // The matrix from FontConfig does not include the scale. 236 cairo_matrix_scale(&fontMatrix, m_size, m_size); 237 } 238 239 m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options)); 240 cairo_font_options_destroy(options); 241 } 242 243 244 } -
trunk/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
r69137 r69320 58 58 FontPlatformData(float size, bool bold, bool italic); 59 59 FontPlatformData(const FontPlatformData&); 60 FontPlatformData(const FontPlatformData&, float size); 60 61 61 62 ~FontPlatformData(); … … 92 93 bool m_fixedWidth; 93 94 PlatformRefPtr<cairo_scaled_font_t> m_scaledFont; 95 96 private: 97 void initializeWithFontFace(cairo_font_face_t*); 94 98 }; 95 99
Note: See TracChangeset
for help on using the changeset viewer.