diff options
author | 2011-10-25 13:43:54 +0000 | |
---|---|---|
committer | 2011-10-25 13:43:54 +0000 | |
commit | dce0d1146bdcbe062efbb5a68d1aa392ef8d2b73 (patch) | |
tree | 2b468d838309321b881c764e5c9a5087e703b92d /src | |
parent | 90d812b77ab025d5fd01dab904287f5c5bf56228 (diff) |
add support for local fonts
http://codereview.appspot.com/5295052/
M src/ports/SkFontHost_mac_coretext.cpp
git-svn-id: http://skia.googlecode.com/svn/trunk@2523 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/ports/SkFontHost_mac_coretext.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp index e10740dedd..4b08973984 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -173,7 +173,11 @@ static SkTypeface::Style computeStyleBits(CTFontRef font, bool* isMonospace) { static SkFontID CTFontRef_to_SkFontID(CTFontRef fontRef) { ATSFontRef ats = CTFontGetPlatformFont(fontRef, NULL); - return (SkFontID)ats; + // CTFontGetPlatformFont returns NULL if the font is local + // (e.g., was created by a CSS3 @font-face rule). + // FIXME: This may fail if fontRef is reused, or if the 64 bit pointer + // duplicates the lowest 32 bits. + return ats ? (SkFontID)ats : (SkFontID)fontRef; } class SkTypeface_Mac : public SkTypeface { |