OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkTypes.h" // Keep this before any #ifdef ... | 9 #include "SkTypes.h" // Keep this before any #ifdef ... |
10 | 10 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 // However, in 10.10.2 color glyphs no longer rotate based on the font trans
form. | 906 // However, in 10.10.2 color glyphs no longer rotate based on the font trans
form. |
907 // So always make the font transform identity and place the transform on the
context. | 907 // So always make the font transform identity and place the transform on the
context. |
908 point = CGPointApplyAffineTransform(point, context.fInvTransform); | 908 point = CGPointApplyAffineTransform(point, context.fInvTransform); |
909 | 909 |
910 // Attempt to keep on the stack a hard reference to the font tables. | 910 // Attempt to keep on the stack a hard reference to the font tables. |
911 // This is an experiment to see if this affects crbug.com/413332 . | 911 // This is an experiment to see if this affects crbug.com/413332 . |
912 // When 10.6 headers are no longer supported, 'sbix' can be replaced with kC
TFontTableSbix. | 912 // When 10.6 headers are no longer supported, 'sbix' can be replaced with kC
TFontTableSbix. |
913 AutoCFRelease<CFDataRef> sbix; | 913 AutoCFRelease<CFDataRef> sbix; |
914 if (static_cast<SkTypeface_Mac*>(context.getTypeface())->fHasColorGlyphs) { | 914 if (static_cast<SkTypeface_Mac*>(context.getTypeface())->fHasColorGlyphs) { |
915 sbix.reset(CGFontCopyTableForTag(context.fCGFont, 'sbix')); | 915 sbix.reset(CGFontCopyTableForTag(context.fCGFont, 'sbix')); |
| 916 // Attempt to read from the sbix table data to determine if the returned
data is valid. |
| 917 const UInt8* sbixData = CFDataGetBytePtr(sbix); |
| 918 CFIndex sbixLength = CFDataGetLength(sbix); |
| 919 if (sbixLength > 0 && *sbixData > 0x80) { |
| 920 // We need to actually do something to avoid this being optimized aw
ay. |
| 921 CFRetain(sbix); |
| 922 CFRelease(sbix); |
| 923 } |
916 } | 924 } |
917 ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG); | 925 ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG); |
918 | 926 |
919 SkASSERT(rowBytesPtr); | 927 SkASSERT(rowBytesPtr); |
920 *rowBytesPtr = rowBytes; | 928 *rowBytesPtr = rowBytes; |
921 return image; | 929 return image; |
922 } | 930 } |
923 | 931 |
924 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co
nst { | 932 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co
nst { |
925 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em
space, y up). | 933 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em
space, y up). |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 } | 2301 } |
2294 return face; | 2302 return face; |
2295 } | 2303 } |
2296 }; | 2304 }; |
2297 | 2305 |
2298 /////////////////////////////////////////////////////////////////////////////// | 2306 /////////////////////////////////////////////////////////////////////////////// |
2299 | 2307 |
2300 SkFontMgr* SkFontMgr::Factory() { | 2308 SkFontMgr* SkFontMgr::Factory() { |
2301 return SkNEW(SkFontMgr_Mac); | 2309 return SkNEW(SkFontMgr_Mac); |
2302 } | 2310 } |
OLD | NEW |