Changeset 109137 in webkit


Ignore:
Timestamp:
Feb 28, 2012 12:28:53 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Reimplement pathFromFont() in SimpleFontDataMac.mm
https://bugs.webkit.org/show_bug.cgi?id=79811

Patch by Ned Holbrook <nholbrook@apple.com> on 2012-02-28
Reviewed by Dan Bernstein.

Debug-only function, so no new tests.

  • platform/graphics/mac/SimpleFontDataMac.mm:

(WebCore::pathFromFont): Reimplemented.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109134 r109137  
     12012-02-28  Ned Holbrook  <nholbrook@apple.com>
     2
     3        Reimplement pathFromFont() in SimpleFontDataMac.mm
     4        https://bugs.webkit.org/show_bug.cgi?id=79811
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Debug-only function, so no new tests.
     9
     10        * platform/graphics/mac/SimpleFontDataMac.mm:
     11        (WebCore::pathFromFont): Reimplemented.
     12
    1132012-02-28  Alexis Menard  <alexis.menard@openbossa.org>
    214
  • trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm

    r109080 r109137  
    8383
    8484#if !ERROR_DISABLED
    85 #if defined(__LP64__) || (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
    86 static NSString* pathFromFont(NSFont*)
    87 {
    88     // FMGetATSFontRefFromFont is not available. As pathFromFont is only used for debugging purposes,
    89     // returning nil is acceptable.
    90     return nil;
    91 }
    92 #else
    93 static NSString* pathFromFont(NSFont *font)
    94 {
    95     ATSFontRef atsFont = FMGetATSFontRefFromFont(CTFontGetPlatformFont(toCTFontRef(font), 0));
    96     FSRef fileRef;
    97 
    98     OSStatus status = ATSFontGetFileReference(atsFont, &fileRef);
    99     if (status != noErr)
    100         return nil;
    101 
    102     UInt8 filePathBuffer[PATH_MAX];
    103     status = FSRefMakePath(&fileRef, filePathBuffer, PATH_MAX);
    104     if (status == noErr)
    105         return [NSString stringWithUTF8String:(const char*)filePathBuffer];
    106 
    107     return nil;
    108 }
    109 #endif // __LP64__
     85static NSString *pathFromFont(NSFont *font)
     86{
     87    return [[[font fontDescriptor] objectForKey:(NSString *)kCTFontURLAttribute] path];
     88}
    11089#endif // !ERROR_DISABLED
    11190
Note: See TracChangeset for help on using the changeset viewer.