Reviewed by Adam Roben.
- use native glyph support in Core Graphics when available
* platform/graphics/win/FontCGWin.cpp:
(WebCore::Font::drawGlyphs): Changed to use drawGDIGlyphs() only if
native glyph support is not available or stroking is required. Changed
to pass the font's useGDI() flag to wkSetCGContextFontRenderingStyle to
request the use of native glyphs.
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Added a call to
wkSetFontPlatformInfo to attach the LOGFONT to the CGFont.
* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::FontPlatformData::platformDataInit): Ditto.
WebKit/win:
Reviewed by Adam Roben.
- WebPreferences changes to support Core Graphics native glyph drawing
* Interfaces/IWebPreferencesPrivate.idl: Added font smoothing contrast
getter and setter.
* WebPreferenceKeysPrivate.h: Added
WebKitFontSmoothingContrastPreferenceKey.
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings): Initialized
WebKitFontSmoothingContrastPreferenceKey to 2.
(WebPreferences::setFloatValue): Added.
(WebPreferences::setFontSmoothing): Changed to map
FontSmoothingTypeWindows to FontSmoothingTypeMedium.
(WebPreferences::fontSmoothingContrast): Added.
(WebPreferences::setFontSmoothingContrast): Added. Calls
wkSetFontSmoothingContrast().
* WebPreferences.h:
WebKitLibraries:
Reviewed by Adam Roben.
- WebKitSystemInterface changes to support Core Graphics native glyph drawing
* win/include/WebKitSystemInterface/WebKitSystemInterface.h:
* win/lib/WebKitSystemInterface.lib:
* win/lib/WebKitSystemInterface_debug.lib:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39736
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-01-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Adam Roben.
+
+ - use native glyph support in Core Graphics when available
+
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::Font::drawGlyphs): Changed to use drawGDIGlyphs() only if
+ native glyph support is not available or stroking is required. Changed
+ to pass the font's useGDI() flag to wkSetCGContextFontRenderingStyle to
+ request the use of native glyphs.
+ * platform/graphics/win/FontCustomPlatformData.cpp:
+ (WebCore::FontCustomPlatformData::fontPlatformData): Added a call to
+ wkSetFontPlatformInfo to attach the LOGFONT to the CGFont.
+ * platform/graphics/win/FontPlatformDataCGWin.cpp:
+ (WebCore::FontPlatformData::platformDataInit): Ditto.
+
2009-01-08 Peter Kasting <pkasting@google.com>
Reviewed by Sam Weinig.
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
int from, int numGlyphs, const FloatPoint& point) const
{
- if (font->m_font.useGDI()) {
- drawGDIGlyphs(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
- return;
- }
-
CGContextRef cgContext = graphicsContext->platformContext();
+ if (font->platformData().useGDI()) {
+ static bool canUsePlatformNativeGlyphs = wkCanUsePlatformNativeGlyphs();
+ if (!canUsePlatformNativeGlyphs || (graphicsContext->textDrawingMode() & cTextStroke)) {
+ drawGDIGlyphs(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
+ return;
+ }
+ }
+
uint32_t oldFontSmoothingStyle = wkSetFontSmoothingStyle(cgContext, WebCoreShouldUseFontSmoothing());
const FontPlatformData& platformData = font->platformData();
FloatSize translation = glyphBuffer.offsetAt(from);
CGContextSetFontSize(cgContext, platformData.size());
- wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false);
+ wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false, font->platformData().useGDI());
IntSize shadowSize;
int shadowBlur;
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#include "SharedBuffer.h"
#include "SoftLinking.h"
#include <ApplicationServices/ApplicationServices.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <wtf/RetainPtr.h>
// From t2embapi.h, which is missing from the Microsoft Platform SDK.
ASSERT(m_fontReference);
ASSERT(T2embedLibrary());
- LOGFONT logFont;
+ static bool canUsePlatformNativeGlyphs = wkCanUsePlatformNativeGlyphs();
+ LOGFONT _logFont;
+
+ LOGFONT& logFont = canUsePlatformNativeGlyphs ? *static_cast<LOGFONT*>(malloc(sizeof(LOGFONT))) : _logFont;
if (m_name.isNull())
TTGetNewFontName(&m_fontReference, logFont.lfFaceName, LF_FACESIZE, 0, 0);
else
logFont.lfWeight = bold ? 700 : 400;
HFONT hfont = CreateFontIndirect(&logFont);
+ if (canUsePlatformNativeGlyphs)
+ wkSetFontPlatformInfo(m_cgFont, &logFont, free);
return FontPlatformData(hfont, m_cgFont, size, bold, italic, renderingMode == AlternateRenderingMode);
}
* This file is part of the internal font implementation. It should not be included by anyone other than
* FontMac.cpp, FontWin.cpp and Font.cpp.
*
- * Copyright (C) 2006, 2007, 2008 Apple Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#include "PlatformString.h"
#include "StringHash.h"
#include <ApplicationServices/ApplicationServices.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
ASSERT(m_cgFont);
}
}
+ if (m_useGDI && wkCanUsePlatformNativeGlyphs()) {
+ LOGFONT* logfont = static_cast<LOGFONT*>(malloc(sizeof(LOGFONT)));
+ GetObject(font, sizeof(*logfont), logfont);
+ wkSetFontPlatformInfo(m_cgFont.get(), logfont, free);
+ }
}
FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI)
+2009-01-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Adam Roben.
+
+ - WebPreferences changes to support Core Graphics native glyph drawing
+
+ * Interfaces/IWebPreferencesPrivate.idl: Added font smoothing contrast
+ getter and setter.
+ * WebPreferenceKeysPrivate.h: Added
+ WebKitFontSmoothingContrastPreferenceKey.
+ * WebPreferences.cpp:
+ (WebPreferences::initializeDefaultSettings): Initialized
+ WebKitFontSmoothingContrastPreferenceKey to 2.
+ (WebPreferences::setFloatValue): Added.
+ (WebPreferences::setFontSmoothing): Changed to map
+ FontSmoothingTypeWindows to FontSmoothingTypeMedium.
+ (WebPreferences::fontSmoothingContrast): Added.
+ (WebPreferences::setFontSmoothingContrast): Added. Calls
+ wkSetFontSmoothingContrast().
+ * WebPreferences.h:
+
2009-01-08 Steve Falkenburg <sfalken@apple.com>
<rdar://problem/6474244> REGRESSION(39561-39603): Heap corruption when saving passwords?
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
HRESULT databasesEnabled([out, retval] BOOL *enabled);
HRESULT setLocalStorageEnabled([in] BOOL enabled);
- HRESULT localStorageEnabled([out, retval] BOOL *enabled);
+ HRESULT localStorageEnabled([out, retval] BOOL* enabled);
+
+ HRESULT setFontSmoothingContrast([in] float contrast);
+ HRESULT fontSmoothingContrast([out, retval] float* contrast);
}
/*
- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
// Windows-specific keys
#define WebKitFontSmoothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2)
+#define WebKitFontSmoothingContrastPreferenceKey "WebKitFontSmoothingContrast" // default: "2"
#define WebKitCookieStorageAcceptPolicyPreferenceKey "WebKitCookieStorageAcceptPolicy" // default: WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain
#define WebContinuousSpellCheckingEnabledPreferenceKey "WebContinuousSpellCheckingEnabled" // default: false
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseLocationKey), CFSTR(""));
CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingTypePreferenceKey), CFSTR("2"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingContrastPreferenceKey), CFSTR("2"));
CFDictionaryAddValue(defaults, CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), CFSTR("2"));
CFDictionaryAddValue(defaults, CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebGrammarCheckingEnabledPreferenceKey), kCFBooleanFalse);
postPreferencesChangesNotification();
}
+void WebPreferences::setFloatValue(CFStringRef key, float value)
+{
+ if (floatValueForKey(key) == value)
+ return;
+
+ setValueForKey(key, cfNumber(value).get());
+
+ postPreferencesChangesNotification();
+}
+
void WebPreferences::setBoolValue(CFStringRef key, BOOL value)
{
if (boolValueForKey(key) == value)
{
setIntegerValue(CFSTR(WebKitFontSmoothingTypePreferenceKey), smoothingType);
if (smoothingType == FontSmoothingTypeWindows)
- smoothingType = FontSmoothingTypeStandard;
+ smoothingType = FontSmoothingTypeMedium;
wkSetFontSmoothingLevel((int)smoothingType);
return S_OK;
}
+HRESULT STDMETHODCALLTYPE WebPreferences::fontSmoothingContrast(
+ /* [retval][out] */ float* contrast)
+{
+ *contrast = floatValueForKey(CFSTR(WebKitFontSmoothingContrastPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothingContrast(
+ /* [in] */ float contrast)
+{
+ setFloatValue(CFSTR(WebKitFontSmoothingContrastPreferenceKey), contrast);
+ wkSetFontSmoothingContrast(contrast);
+ return S_OK;
+}
+
HRESULT STDMETHODCALLTYPE WebPreferences::editableLinkBehavior(
/* [out, retval] */ WebKitEditableLinkBehavior* editableLinkBehavior)
{
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
virtual HRESULT STDMETHODCALLTYPE zoomsTextOnly(
/* [retval][out] */ BOOL *zoomsTextOnly);
+ virtual HRESULT STDMETHODCALLTYPE fontSmoothingContrast(
+ /* [retval][out] */ float* contrast);
+
+ virtual HRESULT STDMETHODCALLTYPE setFontSmoothingContrast(
+ /* [in] */ float contrast);
+
// WebPreferences
// This method accesses a different preference key than developerExtrasEnabled.
void setStringValue(CFStringRef key, LPCTSTR value);
void setIntegerValue(CFStringRef key, int value);
void setBoolValue(CFStringRef key, BOOL value);
+ void setFloatValue(CFStringRef key, float value);
void setLongLongValue(CFStringRef key, LONGLONG value);
static WebPreferences* getInstanceForIdentifier(BSTR identifier);
static void initializeDefaultSettings();
+2009-01-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Adam Roben.
+
+ - WebKitSystemInterface changes to support Core Graphics native glyph drawing
+
+ * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+ * win/lib/WebKitSystemInterface.lib:
+ * win/lib/WebKitSystemInterface_debug.lib:
+
2008-11-11 Ada Chan <adachan@apple.com>
Fix: https://bugs.webkit.org/show_bug.cgi?id=22187
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
void wkSetFontSmoothingLevel(int type);
int wkGetFontSmoothingLevel();
+void wkSetFontSmoothingContrast(CGFloat);
+CGFloat wkGetFontSmoothingContrast();
uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
-void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont);
+bool wkCanUsePlatformNativeGlyphs();
+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);
+void wkSetFontPlatformInfo(CGFontRef, LOGFONT*, void(*)(void*));
void wkSetUpFontCache(size_t s);
void wkAddFontsInDirectory(CFStringRef);
void wkAddFontsAtPath(CFStringRef);