OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the internal font implementation. | 2 * This file is part of the internal font implementation. |
3 * | 3 * |
4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
5 * Copyright (c) 2010 Google Inc. All rights reserved. | 5 * Copyright (c) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #import "platform/fonts/FontPlatformData.h" | 24 #import "platform/fonts/FontPlatformData.h" |
25 | 25 |
| 26 #import <AppKit/NSFont.h> |
| 27 #import <AvailabilityMacros.h> |
26 #import "platform/LayoutTestSupport.h" | 28 #import "platform/LayoutTestSupport.h" |
27 #import "platform/fonts/Font.h" | 29 #import "platform/fonts/Font.h" |
28 #import "platform/fonts/opentype/FontSettings.h" | 30 #import "platform/fonts/opentype/FontSettings.h" |
29 #import "platform/fonts/shaping/HarfBuzzFace.h" | 31 #import "platform/fonts/shaping/HarfBuzzFace.h" |
30 #import "platform/graphics/skia/SkiaUtils.h" | 32 #import "platform/graphics/skia/SkiaUtils.h" |
31 #import "public/platform/Platform.h" | 33 #import "public/platform/Platform.h" |
32 #import "public/platform/mac/WebSandboxSupport.h" | 34 #import "public/platform/mac/WebSandboxSupport.h" |
33 #import "third_party/skia/include/ports/SkTypeface_mac.h" | 35 #import "third_party/skia/include/ports/SkTypeface_mac.h" |
34 #import "wtf/RetainPtr.h" | 36 #import "wtf/RetainPtr.h" |
35 #import "wtf/text/WTFString.h" | 37 #import "wtf/text/WTFString.h" |
36 #import <AppKit/NSFont.h> | |
37 #import <AvailabilityMacros.h> | |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 static bool canLoadInProcess(NSFont* nsFont) { | 41 static bool canLoadInProcess(NSFont* nsFont) { |
42 RetainPtr<CGFontRef> cgFont(AdoptCF, | 42 RetainPtr<CGFontRef> cgFont(AdoptCF, |
43 CTFontCopyGraphicsFont(toCTFontRef(nsFont), 0)); | 43 CTFontCopyGraphicsFont(toCTFontRef(nsFont), 0)); |
44 // Toll-free bridged types CFStringRef and NSString*. | 44 // Toll-free bridged types CFStringRef and NSString*. |
45 RetainPtr<NSString> fontName( | 45 RetainPtr<NSString> fontName( |
46 AdoptNS, const_cast<NSString*>(reinterpret_cast<const NSString*>( | 46 AdoptNS, const_cast<NSString*>(reinterpret_cast<const NSString*>( |
47 CGFontCopyPostScriptName(cgFont.get())))); | 47 CGFontCopyPostScriptName(cgFont.get())))); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); | 191 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
192 // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts | 192 // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts |
193 // axis parameters on system fonts directly. | 193 // axis parameters on system fonts directly. |
194 m_typeface = sk_sp<SkTypeface>(fm->createFromStream( | 194 m_typeface = sk_sp<SkTypeface>(fm->createFromStream( |
195 m_typeface->openStream(nullptr)->duplicate(), | 195 m_typeface->openStream(nullptr)->duplicate(), |
196 SkFontMgr::FontParameters().setAxes(axes, variationSettings->size()))); | 196 SkFontMgr::FontParameters().setAxes(axes, variationSettings->size()))); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 } // namespace blink | 200 } // namespace blink |
OLD | NEW |