Changeset 214785 in webkit
- Timestamp:
- Apr 3, 2017 6:07:59 AM (7 years ago)
- Location:
- releases/WebKitGTK/webkit-2.16/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog
r214783 r214785 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 Chris Dumez <cdumez@apple.com> 2 33 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/PlatformGTK.cmake
r211836 r214785 113 113 platform/graphics/freetype/FontCacheFreeType.cpp 114 114 platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp 115 platform/graphics/freetype/FontPlatformDataFreeType.cpp 115 116 platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp 116 117 platform/graphics/freetype/SimpleFontDataFreeType.cpp … … 187 188 188 189 platform/graphics/PlatformDisplay.cpp 189 190 platform/graphics/freetype/FontPlatformDataFreeType.cpp191 190 192 191 platform/graphics/gtk/ColorGtk.cpp -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
r214763 r214785 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) -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.h
r214763 r214785 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 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
r212513 r214785 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; … … 267 269 268 270 FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern); 271 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get()); 269 272 FcDefaultSubstitute(pattern.get()); 270 273 … … 361 364 // since this is an exact matter of respecting the user's font configuration. 362 365 FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern); 366 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get()); 363 367 FcDefaultSubstitute(pattern.get()); 364 368 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
r211029 r214785 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); … … 306 291 void FontPlatformData::buildScaledFont(cairo_font_face_t* fontFace) 307 292 { 308 CairoUniquePtr<cairo_font_options_t> options = getDefaultCairoFontOptions();293 CairoUniquePtr<cairo_font_options_t> options(cairo_font_options_copy(getDefaultCairoFontOptions())); 309 294 FcPattern* optionsPattern = m_pattern ? m_pattern.get() : getDefaultFontconfigOptions(); 310 295 setCairoFontOptionsFromFontConfigPattern(options.get(), optionsPattern); -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
r165676 r214785 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 } -
releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h
r165676 r214785 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.