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 #ifdef SK_BUILD_FOR_MAC | 9 #ifdef SK_BUILD_FOR_MAC |
10 #import <ApplicationServices/ApplicationServices.h> | 10 #import <ApplicationServices/ApplicationServices.h> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 #include <sys/utsname.h> | 190 #include <sys/utsname.h> |
191 | 191 |
192 typedef uint32_t CGRGBPixel; | 192 typedef uint32_t CGRGBPixel; |
193 | 193 |
194 static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) { | 194 static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) { |
195 return pixel & 0xFF; | 195 return pixel & 0xFF; |
196 } | 196 } |
197 | 197 |
198 // The calls to support subpixel are present in 10.5, but are not included in | |
199 // the 10.5 SDK. The needed calls have been extracted from the 10.6 SDK and are | |
200 // included below. To verify that CGContextSetShouldSubpixelQuantizeFonts, for | |
201 // instance, is present in the 10.5 CoreGraphics libary, use: | |
202 // cd /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ | |
203 // cd ApplicationServices.framework/Frameworks/CoreGraphics.framework/ | |
204 // nm CoreGraphics | grep CGContextSetShouldSubpixelQuantizeFonts | |
205 | |
206 #if !defined(MAC_OS_X_VERSION_10_6) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_
VERSION_10_6) | |
207 CG_EXTERN void CGContextSetAllowsFontSmoothing(CGContextRef context, bool value)
; | |
208 CG_EXTERN void CGContextSetAllowsFontSubpixelPositioning(CGContextRef context, b
ool value); | |
209 CG_EXTERN void CGContextSetShouldSubpixelPositionFonts(CGContextRef context, boo
l value); | |
210 CG_EXTERN void CGContextSetAllowsFontSubpixelQuantization(CGContextRef context,
bool value); | |
211 CG_EXTERN void CGContextSetShouldSubpixelQuantizeFonts(CGContextRef context, boo
l value); | |
212 #endif | |
213 | |
214 static const char FONT_DEFAULT_NAME[] = "Lucida Sans"; | 198 static const char FONT_DEFAULT_NAME[] = "Lucida Sans"; |
215 | 199 |
216 // See Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal fo
r original source. | 200 // See Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal fo
r original source. |
217 static int readVersion() { | 201 static int readVersion() { |
218 struct utsname info; | 202 struct utsname info; |
219 if (uname(&info) != 0) { | 203 if (uname(&info) != 0) { |
220 SkDebugf("uname failed\n"); | 204 SkDebugf("uname failed\n"); |
221 return 0; | 205 return 0; |
222 } | 206 } |
223 if (strcmp(info.sysname, "Darwin") != 0) { | 207 if (strcmp(info.sysname, "Darwin") != 0) { |
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 } | 2211 } |
2228 return face; | 2212 return face; |
2229 } | 2213 } |
2230 }; | 2214 }; |
2231 | 2215 |
2232 /////////////////////////////////////////////////////////////////////////////// | 2216 /////////////////////////////////////////////////////////////////////////////// |
2233 | 2217 |
2234 SkFontMgr* SkFontMgr::Factory() { | 2218 SkFontMgr* SkFontMgr::Factory() { |
2235 return SkNEW(SkFontMgr_Mac); | 2219 return SkNEW(SkFontMgr_Mac); |
2236 } | 2220 } |
OLD | NEW |