Changeset 69137 in webkit
- Timestamp:
- Oct 5, 2010 1:09:25 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69136 r69137 1 2010-10-05 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Support FontPlatformData::isFixedPitch for custom fonts 6 https://bugs.webkit.org/show_bug.cgi?id=47124 7 8 Instead of determining whether or not a font is a fixed-width font 9 lazily, do it up front. For fonts not backed by Fontconfig patterns, 10 fetch information about whether or not the font is fixed-width from 11 the FreeType face. 12 13 No new tests as this should not change functionality. 14 15 * platform/graphics/cairo/FontPlatformDataFreeType.cpp: 16 (WebCore::FontPlatformData::FontPlatformData): Initialize the m_fixedWidth member 17 from the Fontconfig pattern or the FreeType face. 18 (WebCore::FontPlatformData::operator=): Copy over the m_fixedWidth member. 19 (WebCore::FontPlatformData::isFixedPitch): Just return the value of the m_fixedWidth member. 20 * platform/graphics/cairo/FontPlatformDataFreeType.h: Added an m_fixedWidth member. 21 1 22 2010-10-05 David Hyatt <hyatt@apple.com> 2 23 -
trunk/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
r68558 r69137 99 99 , m_syntheticBold(false) 100 100 , m_syntheticOblique(false) 101 , m_fixedWidth(false) 101 102 { 102 103 cairo_font_options_t* options = cairo_font_options_create(); … … 110 111 PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get())); 111 112 m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace.get(), &fontMatrix, &ctm, options)); 113 114 int spacing; 115 if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO) 116 m_fixedWidth = true; 112 117 } 113 118 … … 117 122 , m_syntheticBold(bold) 118 123 , m_syntheticOblique(italic) 124 , m_fixedWidth(false) 119 125 { 120 126 } … … 144 150 145 151 m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options)); 152 153 FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont.get()); 154 if (fontConfigFace) { 155 m_fixedWidth = fontConfigFace->face_flags && FT_FACE_FLAG_FIXED_WIDTH; 156 cairo_ft_scaled_font_unlock_face(m_scaledFont.get()); 157 } 146 158 } 147 159 … … 155 167 m_syntheticBold = other.m_syntheticBold; 156 168 m_syntheticOblique = other.m_syntheticOblique; 169 m_fixedWidth = other.m_fixedWidth; 157 170 m_scaledFont = other.m_scaledFont; 158 171 m_pattern = other.m_pattern; … … 183 196 bool FontPlatformData::isFixedPitch() 184 197 { 185 // TODO: Support isFixedPitch() for custom fonts. 186 if (!m_pattern) 187 return false; 188 189 int spacing; 190 if (FcPatternGetInteger(m_pattern.get(), FC_SPACING, 0, &spacing) == FcResultMatch) 191 return spacing == FC_MONO; 192 return false; 198 return m_fixedWidth; 193 199 } 194 200 -
trunk/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
r68406 r69137 90 90 bool m_syntheticBold; 91 91 bool m_syntheticOblique; 92 bool m_fixedWidth; 92 93 PlatformRefPtr<cairo_scaled_font_t> m_scaledFont; 93 94 };
Note: See TracChangeset
for help on using the changeset viewer.