[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
mitz at apple.com
mitz at apple.com
Tue Jan 5 23:49:46 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 7c7727acadedce77a05dac0e2e367f9ffae1c95b
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 15 08:17:24 2009 +0000
Reviewed by Adam Roben.
WebCore:
WebCore part of <rdar://problem/7173515> Use LOGFONT support in Core
Graphics when available
When using a version of Core Graphics with LOGFONT support, this fixes
<rdar://problem/5764844> First-time launch is painfully slow due to font
plist creation
and <rdar://problem/6576281> 12px synthetic-italics Tahoma text is less
readable in Safari than in Firefox/IE due to poorly-spaced letters
* platform/graphics/win/FontCGWin.cpp:
(WebCore::Font::drawGlyphs): No longer call drawGDIGlyphs for stroked
text.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::createGDIFont): Added a synthesizeItalic parameter. When set
to true, if italics are desired but the best match lacks italics,
creates and returns a synthetic italics font.
(WebCore::FontCache::createFontPlatformData): Ask to synthesize italics
if needed.
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Updated an
assertion, and changed to create the CGFont from the LOGFONT.
(WebCore::createFontCustomPlatformData): Changed cgFont to be a
RetainPtr. Do not create a CGFont from the font data if it can be
created from the LOGFONT in fontPlatformData().
* platform/graphics/win/FontDatabase.cpp:
(WebCore::populateFontDatabase): Avoid font database work if fonts are
not going to be looked up by name.
* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::FontPlatformData::platformDataInit): Create the CGFont from
a LOGFONT based on the HFONT.
WebKitLibraries:
WebKitSystemInterface part of <rdar://problem/7173515> Use LOGFONT support in
Core Graphics when available
* win/include/WebKitSystemInterface/WebKitSystemInterface.h: Declared
wkCanCreateCGFontWithLOGFONT().
* win/lib/WebKitSystemInterface.lib:
* win/lib/WebKitSystemInterface_debug.lib:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6efffef..6c02c5c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,38 @@
+2009-12-15 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebCore part of <rdar://problem/7173515> Use LOGFONT support in Core
+ Graphics when available
+
+ When using a version of Core Graphics with LOGFONT support, this fixes
+ <rdar://problem/5764844> First-time launch is painfully slow due to font
+ plist creation
+ and <rdar://problem/6576281> 12px synthetic-italics Tahoma text is less
+ readable in Safari than in Firefox/IE due to poorly-spaced letters
+
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::Font::drawGlyphs): No longer call drawGDIGlyphs for stroked
+ text.
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::createGDIFont): Added a synthesizeItalic parameter. When set
+ to true, if italics are desired but the best match lacks italics,
+ creates and returns a synthetic italics font.
+ (WebCore::FontCache::createFontPlatformData): Ask to synthesize italics
+ if needed.
+ * platform/graphics/win/FontCustomPlatformData.cpp:
+ (WebCore::FontCustomPlatformData::fontPlatformData): Updated an
+ assertion, and changed to create the CGFont from the LOGFONT.
+ (WebCore::createFontCustomPlatformData): Changed cgFont to be a
+ RetainPtr. Do not create a CGFont from the font data if it can be
+ created from the LOGFONT in fontPlatformData().
+ * platform/graphics/win/FontDatabase.cpp:
+ (WebCore::populateFontDatabase): Avoid font database work if fonts are
+ not going to be looked up by name.
+ * platform/graphics/win/FontPlatformDataCGWin.cpp:
+ (WebCore::FontPlatformData::platformDataInit): Create the CGFont from
+ a LOGFONT based on the HFONT.
+
2009-12-14 Chris Fleizach <cfleizach at apple.com>
Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp
index e901669..653b573 100644
--- a/WebCore/platform/graphics/win/FontCGWin.cpp
+++ b/WebCore/platform/graphics/win/FontCGWin.cpp
@@ -322,7 +322,8 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo
}
if (font->platformData().useGDI()) {
- if (!shouldUseFontSmoothing || (graphicsContext->textDrawingMode() & cTextStroke)) {
+ static bool canCreateCGFontWithLOGFONT = wkCanCreateCGFontWithLOGFONT();
+ if (!shouldUseFontSmoothing || !canCreateCGFontWithLOGFONT && (graphicsContext->textDrawingMode() & cTextStroke)) {
drawGDIGlyphs(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
return;
}
diff --git a/WebCore/platform/graphics/win/FontCacheWin.cpp b/WebCore/platform/graphics/win/FontCacheWin.cpp
index 8663623..11241d0 100644
--- a/WebCore/platform/graphics/win/FontCacheWin.cpp
+++ b/WebCore/platform/graphics/win/FontCacheWin.cpp
@@ -399,7 +399,7 @@ static int CALLBACK matchImprovingEnumProc(CONST LOGFONT* candidate, CONST TEXTM
return 1;
}
-static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool desiredItalic, int size)
+static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool desiredItalic, int size, bool synthesizeItalic)
{
HDC hdc = GetDC(0);
@@ -433,6 +433,9 @@ static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool
matchData.m_chosen.lfQuality = DEFAULT_QUALITY;
matchData.m_chosen.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+ if (desiredItalic && !matchData.m_chosen.lfItalic && synthesizeItalic)
+ matchData.m_chosen.lfItalic = 1;
+
HFONT result = CreateFontIndirect(&matchData.m_chosen);
if (!result)
return 0;
@@ -515,7 +518,8 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
// FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't
// look as nice. That may be solvable though.
LONG weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family);
- HFONT hfont = createGDIFont(family, weight, fontDescription.italic(), fontDescription.computedPixelSize() * (useGDI ? 1 : 32));
+ HFONT hfont = createGDIFont(family, weight, fontDescription.italic(),
+ fontDescription.computedPixelSize() * (useGDI ? 1 : 32), useGDI && wkCanCreateCGFontWithLOGFONT());
if (!hfont)
return 0;
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
index 24db173..b2d1b32 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
@@ -61,7 +61,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontRenderingMode renderingMode)
{
- ASSERT(m_cgFont);
+ ASSERT(wkCanCreateCGFontWithLOGFONT() || m_cgFont);
ASSERT(m_fontReference);
ASSERT(T2embedLibrary());
@@ -87,6 +87,12 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
logFont.lfWeight = bold ? 700 : 400;
HFONT hfont = CreateFontIndirect(&logFont);
+
+ if (wkCanCreateCGFontWithLOGFONT()) {
+ RetainPtr<CGFontRef> cgFont(AdoptCF, CGFontCreateWithPlatformFont(&logFont));
+ return FontPlatformData(hfont, cgFont.get(), size, bold, italic, renderingMode == AlternateRenderingMode);
+ }
+
wkSetFontPlatformInfo(m_cgFont, &logFont, free);
return FontPlatformData(hfont, m_cgFont, size, bold, italic, renderingMode == AlternateRenderingMode);
}
@@ -190,12 +196,15 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
ASSERT_ARG(buffer, buffer);
ASSERT(T2embedLibrary());
- // Get CG to create the font.
- CGDataProviderDirectAccessCallbacks callbacks = { &getData, &releaseData, &getBytesWithOffset, NULL };
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateDirectAccess(buffer, buffer->size(), &callbacks));
- CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider.get());
- if (!cgFont)
- return 0;
+ RetainPtr<CGFontRef> cgFont;
+ if (!wkCanCreateCGFontWithLOGFONT()) {
+ // Get CG to create the font.
+ CGDataProviderDirectAccessCallbacks callbacks = { &getData, &releaseData, &getBytesWithOffset, NULL };
+ RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateDirectAccess(buffer, buffer->size(), &callbacks));
+ cgFont.adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
+ if (!cgFont)
+ return 0;
+ }
// Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's
// font namespace (Windows has no API for creating an HFONT from data without exposing the font to the
@@ -210,10 +219,8 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
size_t overlayDst;
size_t overlaySrc;
size_t overlayLength;
- if (!getEOTHeader(buffer, eotHeader, overlayDst, overlaySrc, overlayLength)) {
- CGFontRelease(cgFont);
+ if (!getEOTHeader(buffer, eotHeader, overlayDst, overlaySrc, overlayLength))
return 0;
- }
HANDLE fontReference;
ULONG privStatus;
@@ -225,13 +232,11 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
fontName = String();
else {
fontReference = renameAndActivateFont(buffer, fontName);
- if (!fontReference) {
- CGFontRelease(cgFont);
+ if (!fontReference)
return 0;
- }
}
- return new FontCustomPlatformData(cgFont, fontReference, fontName);
+ return new FontCustomPlatformData(cgFont.releaseRef(), fontReference, fontName);
}
}
diff --git a/WebCore/platform/graphics/win/FontDatabase.cpp b/WebCore/platform/graphics/win/FontDatabase.cpp
index d0773ea..22ad4a6 100644
--- a/WebCore/platform/graphics/win/FontDatabase.cpp
+++ b/WebCore/platform/graphics/win/FontDatabase.cpp
@@ -188,6 +188,9 @@ void populateFontDatabase()
return;
initialized = true;
+ if (wkCanCreateCGFontWithLOGFONT())
+ return;
+
RetainPtr<CFPropertyListRef> propertyList = readFontPlist();
RetainPtr<CFArrayRef> lastFilenamesFromRegistry;
if (propertyList && CFGetTypeID(propertyList.get()) == CFDictionaryGetTypeID()) {
diff --git a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
index a92e367..d605cf9 100644
--- a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
+++ b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
@@ -109,6 +109,13 @@ static CFStringRef getPostScriptName(CFStringRef faceName, HDC dc)
void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* faceName)
{
+ if (wkCanCreateCGFontWithLOGFONT()) {
+ LOGFONT logfont;
+ GetObject(font, sizeof(logfont), &logfont);
+ m_cgFont.adoptCF(CGFontCreateWithPlatformFont(&logfont));
+ return;
+ }
+
// Try the face name first. Windows may end up localizing this name, and CG doesn't know about
// the localization. If the create fails, we'll try the PostScript name.
RetainPtr<CFStringRef> fullName(AdoptCF, CFStringCreateWithCharacters(NULL, (const UniChar*)faceName, wcslen(faceName)));
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index 541c401..b1548bf 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-15 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKitSystemInterface part of <rdar://problem/7173515> Use LOGFONT support in
+ Core Graphics when available
+
+ * win/include/WebKitSystemInterface/WebKitSystemInterface.h: Declared
+ wkCanCreateCGFontWithLOGFONT().
+ * win/lib/WebKitSystemInterface.lib:
+ * win/lib/WebKitSystemInterface_debug.lib:
+
2009-12-12 Eric Carlson <eric.carlson at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h b/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
index e3feae6..9140f5a 100644
--- a/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
+++ b/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
@@ -58,6 +58,7 @@ void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
+bool wkCanCreateCGFontWithLOGFONT();
void wkSetFontPlatformInfo(CGFontRef, LOGFONT*, void(*)(void*));
void wkSetUpFontCache(size_t s);
void wkAddFontsInDirectory(CFStringRef);
@@ -87,7 +88,7 @@ void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumber
void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
-CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef);
+CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
diff --git a/WebKitLibraries/win/lib/WebKitSystemInterface.lib b/WebKitLibraries/win/lib/WebKitSystemInterface.lib
index 60d4e1e..de6c902 100644
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ
diff --git a/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib b/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib
index 56cbdcf..4af8123 100644
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib differ
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list