Changeset 39736 in webkit


Ignore:
Timestamp:
Jan 8, 2009 7:45:20 PM (15 years ago)
Author:
mitz@apple.com
Message:

WebCore:

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:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39734 r39736  
     12009-01-08  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - use native glyph support in Core Graphics when available
     6
     7        * platform/graphics/win/FontCGWin.cpp:
     8        (WebCore::Font::drawGlyphs): Changed to use drawGDIGlyphs() only if
     9        native glyph support is not available or stroking is required. Changed
     10        to pass the font's useGDI() flag to wkSetCGContextFontRenderingStyle to
     11        request the use of native glyphs.
     12        * platform/graphics/win/FontCustomPlatformData.cpp:
     13        (WebCore::FontCustomPlatformData::fontPlatformData): Added a call to
     14        wkSetFontPlatformInfo to attach the LOGFONT to the CGFont.
     15        * platform/graphics/win/FontPlatformDataCGWin.cpp:
     16        (WebCore::FontPlatformData::platformDataInit): Ditto.
     17
    1182009-01-08  Peter Kasting  <pkasting@google.com>
    219
  • trunk/WebCore/platform/graphics/win/FontCGWin.cpp

    r39635 r39736  
    11/*
    2  * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    295295                      int from, int numGlyphs, const FloatPoint& point) const
    296296{
    297     if (font->m_font.useGDI()) {
    298         drawGDIGlyphs(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
    299         return;
    300     }
    301 
    302297    CGContextRef cgContext = graphicsContext->platformContext();
     298
     299    if (font->platformData().useGDI()) {
     300        static bool canUsePlatformNativeGlyphs = wkCanUsePlatformNativeGlyphs();
     301        if (!canUsePlatformNativeGlyphs || (graphicsContext->textDrawingMode() & cTextStroke)) {
     302            drawGDIGlyphs(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
     303            return;
     304        }
     305    }
    303306
    304307    uint32_t oldFontSmoothingStyle = wkSetFontSmoothingStyle(cgContext, WebCoreShouldUseFontSmoothing());
     
    323326
    324327    CGContextSetFontSize(cgContext, platformData.size());
    325     wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false);
     328    wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false, font->platformData().useGDI());
    326329
    327330    IntSize shadowSize;
  • trunk/WebCore/platform/graphics/win/FontCustomPlatformData.cpp

    r37139 r39736  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    2828#include "SoftLinking.h"
    2929#include <ApplicationServices/ApplicationServices.h>
     30#include <WebKitSystemInterface/WebKitSystemInterface.h>
    3031#include <wtf/RetainPtr.h>
    3132
     
    6566    ASSERT(T2embedLibrary());
    6667
    67     LOGFONT logFont;
     68    static bool canUsePlatformNativeGlyphs = wkCanUsePlatformNativeGlyphs();
     69    LOGFONT _logFont;
     70
     71    LOGFONT& logFont = canUsePlatformNativeGlyphs ? *static_cast<LOGFONT*>(malloc(sizeof(LOGFONT))) : _logFont;
    6872    if (m_name.isNull())
    6973        TTGetNewFontName(&m_fontReference, logFont.lfFaceName, LF_FACESIZE, 0, 0);
     
    8791
    8892    HFONT hfont = CreateFontIndirect(&logFont);
     93    if (canUsePlatformNativeGlyphs)
     94        wkSetFontPlatformInfo(m_cgFont, &logFont, free);
    8995    return FontPlatformData(hfont, m_cgFont, size, bold, italic, renderingMode == AlternateRenderingMode);
    9096}
  • trunk/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp

    r31507 r39736  
    33 * FontMac.cpp, FontWin.cpp and Font.cpp.
    44 *
    5  * Copyright (C) 2006, 2007, 2008 Apple Inc.
     5 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2828#include "StringHash.h"
    2929#include <ApplicationServices/ApplicationServices.h>
     30#include <WebKitSystemInterface/WebKitSystemInterface.h>
    3031#include <wtf/HashMap.h>
    3132#include <wtf/RetainPtr.h>
     
    120121        }
    121122    }
     123    if (m_useGDI && wkCanUsePlatformNativeGlyphs()) {
     124        LOGFONT* logfont = static_cast<LOGFONT*>(malloc(sizeof(LOGFONT)));
     125        GetObject(font, sizeof(*logfont), logfont);
     126        wkSetFontPlatformInfo(m_cgFont.get(), logfont, free);
     127    }
    122128}
    123129
  • trunk/WebKit/win/ChangeLog

    r39735 r39736  
     12009-01-08  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - WebPreferences changes to support Core Graphics native glyph drawing
     6
     7        * Interfaces/IWebPreferencesPrivate.idl: Added font smoothing contrast
     8        getter and setter.
     9        * WebPreferenceKeysPrivate.h: Added
     10        WebKitFontSmoothingContrastPreferenceKey.
     11        * WebPreferences.cpp:
     12        (WebPreferences::initializeDefaultSettings): Initialized
     13        WebKitFontSmoothingContrastPreferenceKey to 2.
     14        (WebPreferences::setFloatValue): Added.
     15        (WebPreferences::setFontSmoothing): Changed to map
     16        FontSmoothingTypeWindows to FontSmoothingTypeMedium.
     17        (WebPreferences::fontSmoothingContrast): Added.
     18        (WebPreferences::setFontSmoothingContrast): Added. Calls
     19        wkSetFontSmoothingContrast().
     20        * WebPreferences.h:
     21
    1222009-01-08  Steve Falkenburg  <sfalken@apple.com>
    223
  • trunk/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r39227 r39736  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6666
    6767    HRESULT setLocalStorageEnabled([in] BOOL enabled);
    68     HRESULT localStorageEnabled([out, retval] BOOL *enabled);
     68    HRESULT localStorageEnabled([out, retval] BOOL* enabled);
     69
     70    HRESULT setFontSmoothingContrast([in] float contrast);
     71    HRESULT fontSmoothingContrast([out, retval] float* contrast);
    6972}
  • trunk/WebKit/win/WebPreferenceKeysPrivate.h

    r39227 r39736  
    11/*
    2  * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9292// Windows-specific keys
    9393#define WebKitFontSmoothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2)
     94#define WebKitFontSmoothingContrastPreferenceKey "WebKitFontSmoothingContrast" // default: "2"
    9495#define WebKitCookieStorageAcceptPolicyPreferenceKey "WebKitCookieStorageAcceptPolicy" // default: WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain
    9596
  • trunk/WebKit/win/WebPreferences.cpp

    r39227 r39736  
    11/*
    2  * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    224224    CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseEnabledPreferenceKey), kCFBooleanTrue);
    225225    CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingTypePreferenceKey), CFSTR("2"));
     226    CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingContrastPreferenceKey), CFSTR("2"));
    226227    CFDictionaryAddValue(defaults, CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), CFSTR("2"));
    227228    CFDictionaryAddValue(defaults, CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), kCFBooleanFalse);
     
    330331{
    331332    if (integerValueForKey(key) == value)
     333        return;
     334
     335    setValueForKey(key, cfNumber(value).get());
     336
     337    postPreferencesChangesNotification();
     338}
     339
     340void WebPreferences::setFloatValue(CFStringRef key, float value)
     341{
     342    if (floatValueForKey(key) == value)
    332343        return;
    333344
     
    966977    setIntegerValue(CFSTR(WebKitFontSmoothingTypePreferenceKey), smoothingType);
    967978    if (smoothingType == FontSmoothingTypeWindows)
    968         smoothingType = FontSmoothingTypeStandard;
     979        smoothingType = FontSmoothingTypeMedium;
    969980    wkSetFontSmoothingLevel((int)smoothingType);
     981    return S_OK;
     982}
     983
     984HRESULT STDMETHODCALLTYPE WebPreferences::fontSmoothingContrast(
     985    /* [retval][out] */ float* contrast)
     986{
     987    *contrast = floatValueForKey(CFSTR(WebKitFontSmoothingContrastPreferenceKey));
     988    return S_OK;
     989}
     990
     991HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothingContrast(
     992    /* [in] */ float contrast)
     993{
     994    setFloatValue(CFSTR(WebKitFontSmoothingContrastPreferenceKey), contrast);
     995    wkSetFontSmoothingContrast(contrast);
    970996    return S_OK;
    971997}
  • trunk/WebKit/win/WebPreferences.h

    r39227 r39736  
    11/*
    2  * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    339339    /* [retval][out] */ BOOL *zoomsTextOnly);
    340340
     341    virtual HRESULT STDMETHODCALLTYPE fontSmoothingContrast(
     342    /* [retval][out] */ float* contrast);
     343   
     344    virtual HRESULT STDMETHODCALLTYPE setFontSmoothingContrast(
     345    /* [in] */ float contrast);
     346
    341347    // WebPreferences
    342348
     
    374380    void setIntegerValue(CFStringRef key, int value);
    375381    void setBoolValue(CFStringRef key, BOOL value);
     382    void setFloatValue(CFStringRef key, float value);
    376383    void setLongLongValue(CFStringRef key, LONGLONG value);
    377384    static WebPreferences* getInstanceForIdentifier(BSTR identifier);
  • trunk/WebKitLibraries/ChangeLog

    r38319 r39736  
     12009-01-08  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - WebKitSystemInterface changes to support Core Graphics native glyph drawing
     6
     7        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
     8        * win/lib/WebKitSystemInterface.lib:
     9        * win/lib/WebKitSystemInterface_debug.lib:
     10
    1112008-11-11  Ada Chan  <adachan@apple.com>
    212
  • trunk/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h

    r33431 r39736  
    11/*
    2  * Copyright (C) 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646void wkSetFontSmoothingLevel(int type);
    4747int wkGetFontSmoothingLevel();
     48void wkSetFontSmoothingContrast(CGFloat);
     49CGFloat wkGetFontSmoothingContrast();
    4850uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
    4951void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
    50 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont);
     52bool wkCanUsePlatformNativeGlyphs();
     53void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
    5154void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
    5255void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
     56void wkSetFontPlatformInfo(CGFontRef, LOGFONT*, void(*)(void*));
    5357void wkSetUpFontCache(size_t s);
    5458void wkAddFontsInDirectory(CFStringRef);
Note: See TracChangeset for help on using the changeset viewer.