Changeset 29418 in webkit
- Timestamp:
- Jan 11, 2008 1:58:11 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r29416 r29418 1 2008-01-11 Alp Toker <alp@atoker.com> 2 3 Reviewed by Dave Hyatt and Mark Rowe. 4 5 http://bugs.webkit.org/show_bug.cgi?id=16089 6 [GTK] Support custom fonts, CachedFont::platformDataFromCustomData() 7 8 Add support for CSS2 @font-face custom/downloadable fonts to the GTK+ 9 port. 10 11 * GNUmakefile.am: 12 * WebCore.pro: 13 * loader/CachedFont.cpp: 14 (WebCore::CachedFont::~CachedFont): 15 (WebCore::CachedFont::ensureCustomFontData): 16 (WebCore::CachedFont::platformDataFromCustomData): 17 (WebCore::CachedFont::allReferencesRemoved): 18 * platform/graphics/gtk/FontCustomPlatformData.cpp: Added. 19 (WebCore::FontCustomPlatformData::~FontCustomPlatformData): 20 (WebCore::FontCustomPlatformData::fontPlatformData): 21 (WebCore::releaseData): 22 (WebCore::createFontCustomPlatformData): 23 * platform/graphics/gtk/FontCustomPlatformData.h: Added. 24 (WebCore::FontCustomPlatformData::FontCustomPlatformData): 25 * platform/graphics/gtk/FontPlatformData.h: 26 * platform/graphics/gtk/FontPlatformDataGtk.cpp: 27 (WebCore::FontPlatformData::FontPlatformData): 28 (WebCore::FontPlatformData::init): 29 (WebCore::FontPlatformData::isFixedPitch): 30 * platform/graphics/gtk/SimpleFontDataGtk.cpp: 31 (WebCore::SimpleFontData::platformDestroy): 32 1 33 2008-01-11 Adam Roben <aroben@apple.com> 2 34 -
trunk/WebCore/GNUmakefile.am
r29399 r29418 936 936 WebCore/platform/gtk/FileSystemGtk.cpp \ 937 937 WebCore/platform/graphics/gtk/FontCacheGtk.cpp \ 938 WebCore/platform/graphics/gtk/FontCustomPlatformData.cpp \ 938 939 WebCore/platform/graphics/gtk/FontGtk.cpp \ 939 940 WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp \ -
trunk/WebCore/WebCore.pro
r29399 r29418 1006 1006 platform/gtk/FileSystemGtk.cpp \ 1007 1007 platform/graphics/gtk/FontCacheGtk.cpp \ 1008 platform/graphics/gtk/FontCustomPlatformData.cpp \ 1008 1009 platform/graphics/gtk/FontGtk.cpp \ 1009 1010 platform/graphics/gtk/FontPlatformDataGtk.cpp \ -
trunk/WebCore/loader/CachedFont.cpp
r27973 r29418 31 31 #include "CachedResourceClientWalker.h" 32 32 #include "FontPlatformData.h" 33 #if PLATFORM(CG) || PLATFORM(QT) 33 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) 34 34 #include "FontCustomPlatformData.h" 35 35 #endif … … 50 50 CachedFont::~CachedFont() 51 51 { 52 #if PLATFORM(CG) || PLATFORM(QT) 52 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) 53 53 delete m_fontData; 54 54 #endif … … 84 84 bool CachedFont::ensureCustomFontData() 85 85 { 86 #if PLATFORM(CG) || PLATFORM(QT) 86 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) 87 87 if (!m_fontData && !m_errorOccurred && !m_loading) { 88 88 m_fontData = createFontCustomPlatformData(m_data.get()); … … 96 96 FontPlatformData CachedFont::platformDataFromCustomData(int size, bool bold, bool italic) 97 97 { 98 #if PLATFORM(CG) || PLATFORM(QT) 98 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) 99 99 ASSERT(m_fontData); 100 100 return m_fontData->fontPlatformData(size, bold, italic); … … 106 106 void CachedFont::allReferencesRemoved() 107 107 { 108 #if PLATFORM(CG) || PLATFORM(QT) 108 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) 109 109 if (m_fontData) { 110 110 delete m_fontData; -
trunk/WebCore/platform/graphics/gtk/FontPlatformData.h
r28921 r29418 50 50 51 51 FontPlatformData(const FontDescription&, const AtomicString& family); 52 53 FontPlatformData(cairo_font_face_t* fontFace, int size, bool bold, bool italic); 54 52 55 ~FontPlatformData(); 53 56 -
trunk/WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp
r28921 r29418 1 1 /* 2 * This file is part of the internal font implementation. It should not be included by anyone other than3 * FontMac.cpp, FontWin.cpp and Font.cpp.4 *5 2 * Copyright (C) 2006 Apple Computer, Inc. 6 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 7 * Copyright (C) 2007 Alp Toker <alp@atoker.com>4 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> 8 5 * Copyright (C) 2007 Holger Hans Peter Freyther 9 6 * All rights reserved. … … 23 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 21 * Boston, MA 02110-1301, USA. 25 *26 22 */ 27 23 … … 112 108 } 113 109 110 FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, int size, bool bold, bool italic) 111 : m_pattern(0) 112 , m_fontDescription() 113 , m_scaledFont(0) 114 { 115 cairo_matrix_t fontMatrix; 116 cairo_matrix_init_scale(&fontMatrix, size, size); 117 cairo_matrix_t ctm; 118 cairo_matrix_init_identity(&ctm); 119 cairo_font_options_t* options = cairo_font_options_create(); 120 121 // We force antialiasing and disable hinting to provide consistent 122 // typographic qualities for custom fonts on all platforms. 123 cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE); 124 cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY); 125 126 m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options); 127 cairo_font_options_destroy(options); 128 } 129 114 130 bool FontPlatformData::init() 115 131 { 116 static bool initialized ;132 static bool initialized = false; 117 133 if (initialized) 118 134 return true; 119 initialized = true;120 135 if (!FcInit()) { 121 136 fprintf(stderr, "Can't init font config library\n"); 122 137 return false; 123 138 } 139 initialized = true; 124 140 return true; 125 141 } … … 131 147 bool FontPlatformData::isFixedPitch() 132 148 { 149 // TODO: Support isFixedPitch() for custom fonts. 150 if (!m_pattern) 151 return false; 152 133 153 int spacing; 134 154 if (FcPatternGetInteger(m_pattern, FC_SPACING, 0, &spacing) == FcResultMatch) -
trunk/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp
r29250 r29418 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 4 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>4 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> 5 5 * Copyright (C) 2007 Holger Hans Peter Freyther 6 6 * All rights reserved. … … 63 63 void SimpleFontData::platformDestroy() 64 64 { 65 if (m_font.m_pattern && ((FcPattern*)-1 != m_font.m_pattern)) 66 FcPatternDestroy(m_font.m_pattern); 65 if (!isCustomFont()) { 66 if (m_font.m_pattern && ((FcPattern*)-1 != m_font.m_pattern)) { 67 FcPatternDestroy(m_font.m_pattern); 68 m_font.m_pattern = 0; 69 } 67 70 68 if (m_font.m_scaledFont) 69 cairo_scaled_font_destroy(m_font.m_scaledFont); 71 if (m_font.m_scaledFont) { 72 cairo_scaled_font_destroy(m_font.m_scaledFont); 73 m_font.m_scaledFont = 0; 74 } 75 } 76 70 77 delete m_smallCapsFontData; 71 78 }
Note: See TracChangeset
for help on using the changeset viewer.