Changeset 63595 in webkit


Ignore:
Timestamp:
Jul 16, 2010 4:03:40 PM (14 years ago)
Author:
mitz@apple.com
Message:

Part of <rdar://problem/7233974> Deprecate +[WebView _setShouldUseFontSmoothing:]
https://bugs.webkit.org/show_bug.cgi?id=29355

Reviewed by Sam Weinig.

WebCore:

  • WebCore.exp.in: Updated.
  • platform/graphics/Font.cpp:

(WebCore::Font::Font): Added a font smoothing mode parameter to the constructor.
Set the font smoothing mode in the font description.

  • platform/graphics/Font.h:

WebKit/mac:

  • Misc/WebKitNSStringExtras.h:
  • Misc/WebKitNSStringExtras.mm:

(-[NSString _web_drawAtPoint:font:textColor:]): Now calls through to
-_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing YES for the last
parameter.
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Added
allowingFontSmoothing:. If font smoothing is not allowed, sets the font smoothing
mode to antialiased. Otherwise, sets it to auto.
(-[NSString _web_drawDoubledAtPoint:withTopColor:bottomColor:font:]): Instead of
changing the font smoothing setting in the graphics context, call
-_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing NO for the last
parameter.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63594 r63595  
     12010-07-16  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Part of <rdar://problem/7233974> Deprecate +[WebView _setShouldUseFontSmoothing:]
     6        https://bugs.webkit.org/show_bug.cgi?id=29355
     7
     8        * WebCore.exp.in: Updated.
     9        * platform/graphics/Font.cpp:
     10        (WebCore::Font::Font): Added a font smoothing mode parameter to the constructor.
     11        Set the font smoothing mode in the font description.
     12        * platform/graphics/Font.h:
     13
    1142010-07-16  Satish Sampath  <satish@chromium.org>
    215
  • trunk/WebCore/WebCore.exp.in

    r63521 r63595  
    483483__ZN7WebCore4Font18shouldUseSmoothingEv
    484484__ZN7WebCore4Font21setShouldUseSmoothingEb
    485 __ZN7WebCore4FontC1ERKNS_16FontPlatformDataEb
     485__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
    486486__ZN7WebCore4FontC1Ev
    487487__ZN7WebCore4FontaSERKS0_
  • trunk/WebCore/platform/graphics/Font.cpp

    r61253 r63595  
    7373}
    7474
    75 Font::Font(const FontPlatformData& fontData, bool isPrinterFont)
     75Font::Font(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
    7676    : m_fontList(FontFallbackList::create())
    7777    , m_letterSpacing(0)
     
    8181{
    8282    m_fontDescription.setUsePrinterFont(isPrinterFont);
     83    m_fontDescription.setFontSmoothing(fontSmoothingMode);
    8384    m_fontList->setPlatformFont(fontData);
    8485}
  • trunk/WebCore/platform/graphics/Font.h

    r63570 r63595  
    7777    Font(const FontDescription&, short letterSpacing, short wordSpacing);
    7878    // This constructor is only used if the platform wants to start with a native font.
    79     Font(const FontPlatformData&, bool isPrinting);
     79    Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
    8080    ~Font();
    8181
  • trunk/WebKit/mac/ChangeLog

    r63591 r63595  
     12010-07-16  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Part of <rdar://problem/7233974> Deprecate +[WebView _setShouldUseFontSmoothing:]
     6        https://bugs.webkit.org/show_bug.cgi?id=29355
     7
     8        * Misc/WebKitNSStringExtras.h:
     9        * Misc/WebKitNSStringExtras.mm:
     10        (-[NSString _web_drawAtPoint:font:textColor:]): Now calls through to
     11        -_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing YES for the last
     12        parameter.
     13        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Added
     14        allowingFontSmoothing:. If font smoothing is not allowed, sets the font smoothing
     15        mode to antialiased. Otherwise, sets it to auto.
     16        (-[NSString _web_drawDoubledAtPoint:withTopColor:bottomColor:font:]): Instead of
     17        changing the font smoothing setting in the graphics context, call
     18        -_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing NO for the last
     19        parameter.
     20
    1212010-07-16  Anders Carlsson  <andersca@apple.com>
    222
  • trunk/WebKit/mac/Misc/WebKitNSStringExtras.h

    r43721 r63595  
    3333@interface NSString (WebKitExtras)
    3434
     35- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed;
    3536- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor;
    3637- (void)_web_drawDoubledAtPoint:(NSPoint)textPoint withTopColor:(NSColor *)topColor bottomColor:(NSColor *)bottomColor font:(NSFont *)font;
  • trunk/WebKit/mac/Misc/WebKitNSStringExtras.mm

    r50760 r63595  
    6363- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor
    6464{
    65     // FIXME: Would be more efficient to change this to C++ and use Vector<UChar, 2048>.
     65    [self _web_drawAtPoint:point font:font textColor:textColor allowingFontSmoothing:YES];
     66}
     67
     68- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed
     69{
    6670    unsigned length = [self length];
    6771    Vector<UniChar, 2048> buffer(length);
    6872
    6973    [self getCharacters:buffer.data()];
    70    
     74
    7175    if (canUseFastRenderer(buffer.data(), length)) {
    7276        // The following is a half-assed attempt to match AppKit's rounding rules for drawAtPoint.
     
    8589            CGContextScaleCTM(cgContext, 1, -1);
    8690
    87         Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen]);
     91        Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
    8892        TextRun run(buffer.data(), length);
    8993        run.disableRoundingHacks();
     
    117121{
    118122    // turn off font smoothing so translucent text draws correctly (Radar 3118455)
    119     [NSGraphicsContext saveGraphicsState];
    120     CGContextSetShouldSmoothFonts(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), false);
    121     [self _web_drawAtPoint:textPoint
    122                       font:font
    123                  textColor:bottomColor];
     123    [self _web_drawAtPoint:textPoint font:font textColor:bottomColor allowingFontSmoothing:NO];
    124124
    125125    textPoint.y += 1;
    126     [self _web_drawAtPoint:textPoint
    127                       font:font
    128                  textColor:topColor];
    129     [NSGraphicsContext restoreGraphicsState];
     126    [self _web_drawAtPoint:textPoint font:font textColor:topColor allowingFontSmoothing:NO];
    130127}
    131128
Note: See TracChangeset for help on using the changeset viewer.