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. |
(...skipping 25 matching lines...) Expand all Loading... |
36 #import "wtf/RetainPtr.h" | 36 #import "wtf/RetainPtr.h" |
37 #import "wtf/text/WTFString.h" | 37 #import "wtf/text/WTFString.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, |
47 CGFontCopyPostScriptName(cgFont.get())))); | 47 const_cast<NSString*>(reinterpret_cast<const NSString*>( |
| 48 CGFontCopyPostScriptName(cgFont.get())))); |
48 return ![fontName.get() isEqualToString:@"LastResort"]; | 49 return ![fontName.get() isEqualToString:@"LastResort"]; |
49 } | 50 } |
50 | 51 |
51 static CTFontDescriptorRef cascadeToLastResortFontDescriptor() { | 52 static CTFontDescriptorRef cascadeToLastResortFontDescriptor() { |
52 static CTFontDescriptorRef descriptor; | 53 static CTFontDescriptorRef descriptor; |
53 if (descriptor) | 54 if (descriptor) |
54 return descriptor; | 55 return descriptor; |
55 | 56 |
56 RetainPtr<CTFontDescriptorRef> lastResort( | 57 RetainPtr<CTFontDescriptorRef> lastResort( |
57 AdoptCF, CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0)); | 58 AdoptCF, CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); | 192 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
192 // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts | 193 // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts |
193 // axis parameters on system fonts directly. | 194 // axis parameters on system fonts directly. |
194 m_typeface = sk_sp<SkTypeface>(fm->createFromStream( | 195 m_typeface = sk_sp<SkTypeface>(fm->createFromStream( |
195 m_typeface->openStream(nullptr)->duplicate(), | 196 m_typeface->openStream(nullptr)->duplicate(), |
196 SkFontMgr::FontParameters().setAxes(axes, variationSettings->size()))); | 197 SkFontMgr::FontParameters().setAxes(axes, variationSettings->size()))); |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 } // namespace blink | 201 } // namespace blink |
OLD | NEW |