Changeset 214283 in webkit
- Timestamp:
- Mar 22, 2017 4:18:54 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r214282 r214283 1 2017-03-22 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [GTK] Honor GTK+ font settings 4 https://bugs.webkit.org/show_bug.cgi?id=82889 5 6 Reviewed by Carlos Garcia Campos. 7 8 After much discussion with Behdad and Martin (who is still not completely convinced I think 9 :) I want to merge cairo font options into the Fontconfig pattern used for rendering using 10 cairo_ft_font_options_substitute(). This is how the API was designed to be used anyway. 11 Fontconfig will still have final say over whether to actually respect the desktop settings 12 or not, so it can still choose to ignore the desktop's settings, but I don't think it makes 13 sense to have desktop-wide font settings and not tell Fontconfig about them, especially when 14 the whole point of WebKitGTK+ is desktop integration. This should also reduce complaints 15 that we're not following desktop settings and that we're drawing fonts differently than 16 Firefox. 17 18 * PlatformGTK.cmake: 19 * platform/graphics/cairo/CairoUtilities.cpp: 20 (WebCore::getDefaultCairoFontOptions): 21 * platform/graphics/cairo/CairoUtilities.h: 22 * platform/graphics/freetype/FontCacheFreeType.cpp: 23 (WebCore::createFontConfigPatternForCharacters): 24 (WebCore::strongAliasesForFamily): 25 (WebCore::FontCache::createFontPlatformData): 26 * platform/graphics/freetype/FontPlatformDataFreeType.cpp: 27 (WebCore::getDefaultFontconfigOptions): 28 (WebCore::getDefaultCairoFontOptions): Deleted. 29 * platform/graphics/gtk/GdkCairoUtilities.cpp: 30 (getDefaultCairoFontOptions): 31 1 32 2017-03-22 Antoine Quint <graouts@apple.com> 2 33 -
trunk/Source/WebCore/PlatformGTK.cmake
r214244 r214283 114 114 platform/graphics/freetype/FontCacheFreeType.cpp 115 115 platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp 116 platform/graphics/freetype/FontPlatformDataFreeType.cpp 116 117 platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp 117 118 platform/graphics/freetype/SimpleFontDataFreeType.cpp … … 188 189 189 190 platform/graphics/PlatformDisplay.cpp 190 191 platform/graphics/freetype/FontPlatformDataFreeType.cpp192 191 193 192 platform/graphics/gtk/ColorGtk.cpp -
trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
r214100 r214283 40 40 #include "Region.h" 41 41 #include <wtf/Assertions.h> 42 #include <wtf/NeverDestroyed.h> 42 43 #include <wtf/Vector.h> 43 44 … … 47 48 48 49 namespace WebCore { 50 51 #if USE(FREETYPE) && !PLATFORM(GTK) 52 const cairo_font_options_t* getDefaultCairoFontOptions() 53 { 54 static NeverDestroyed<cairo_font_options_t*> options = cairo_font_options_create(); 55 return options; 56 } 57 #endif 49 58 50 59 void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) -
trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h
r214100 r214283 25 25 */ 26 26 27 #ifndef CairoUtilities_h 28 #define CairoUtilities_h 27 #pragma once 29 28 30 29 #if USE(CAIRO) … … 72 71 FT_Face m_ftFace { nullptr }; 73 72 }; 73 74 const cairo_font_options_t* getDefaultCairoFontOptions(); 74 75 #endif 75 76 … … 98 99 99 100 #endif // USE(CAIRO) 100 101 #endif // CairoUtilities_h -
trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
r213486 r214283 23 23 #include "FontCache.h" 24 24 25 #include "CairoUtilities.h" 25 26 #include "FcUniquePtr.h" 26 27 #include "Font.h" … … 58 59 FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue); 59 60 FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern); 61 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get()); 60 62 FcDefaultSubstitute(pattern.get()); 61 63 return pattern; … … 261 263 262 264 FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern); 265 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get()); 263 266 FcDefaultSubstitute(pattern.get()); 264 267 … … 355 358 // since this is an exact matter of respecting the user's font configuration. 356 359 FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern); 360 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get()); 357 361 FcDefaultSubstitute(pattern.get()); 358 362 -
trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
r213532 r214283 38 38 #include <wtf/text/WTFString.h> 39 39 40 #if PLATFORM(GTK)41 #include <gdk/gdk.h>42 #endif43 44 40 namespace WebCore { 45 41 … … 107 103 } 108 104 109 static CairoUniquePtr<cairo_font_options_t> getDefaultCairoFontOptions()110 {111 #if PLATFORM(GTK)112 if (GdkScreen* screen = gdk_screen_get_default()) {113 const cairo_font_options_t* screenOptions = gdk_screen_get_font_options(screen);114 if (screenOptions)115 return CairoUniquePtr<cairo_font_options_t>(cairo_font_options_copy(screenOptions));116 }117 #endif118 return CairoUniquePtr<cairo_font_options_t>(cairo_font_options_create());119 }120 121 105 static FcPattern* getDefaultFontconfigOptions() 122 106 { … … 130 114 pattern = FcPatternCreate(); 131 115 FcConfigSubstitute(nullptr, pattern, FcMatchPattern); 116 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern); 132 117 FcDefaultSubstitute(pattern); 133 118 FcPatternDel(pattern, FC_FAMILY); … … 309 294 void FontPlatformData::buildScaledFont(cairo_font_face_t* fontFace) 310 295 { 311 CairoUniquePtr<cairo_font_options_t> options = getDefaultCairoFontOptions();296 CairoUniquePtr<cairo_font_options_t> options(cairo_font_options_copy(getDefaultCairoFontOptions())); 312 297 FcPattern* optionsPattern = m_pattern ? m_pattern.get() : getDefaultFontconfigOptions(); 313 298 setCairoFontOptionsFromFontConfigPattern(options.get(), optionsPattern); -
trunk/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
r165676 r214283 32 32 #include <cairo.h> 33 33 #include <gtk/gtk.h> 34 #include <mutex> 35 #include <wtf/NeverDestroyed.h> 34 36 35 using namespace WebCore; 37 namespace WebCore { 38 39 const cairo_font_options_t* getDefaultCairoFontOptions() 40 { 41 if (auto* screen = gdk_screen_get_default()) { 42 if (auto* options = gdk_screen_get_font_options(screen)) 43 return options; 44 } 45 46 static LazyNeverDestroyed<cairo_font_options_t*> options; 47 static std::once_flag flag; 48 std::call_once(flag, [] { 49 options.construct(cairo_font_options_create()); 50 }); 51 return options; 52 } 36 53 37 54 GdkPixbuf* cairoSurfaceToGdkPixbuf(cairo_surface_t* surface) … … 41 58 } 42 59 60 } -
trunk/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h
r165676 r214283 24 24 */ 25 25 26 #ifndef GdkCairoUtilities_h 27 #define GdkCairoUtilities_h 26 #pragma once 27 28 namespace WebCore { 28 29 29 30 GdkPixbuf* cairoSurfaceToGdkPixbuf(cairo_surface_t*); 30 31 31 #endif // GdkCairoUtilities_h 32 }
Note: See TracChangeset
for help on using the changeset viewer.