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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 static sk_sp<SkTypeface> loadFromBrowserProcess(NSFont* nsFont, | 77 static sk_sp<SkTypeface> loadFromBrowserProcess(NSFont* nsFont, |
78 float textSize) { | 78 float textSize) { |
79 // Send cross-process request to load font. | 79 // Send cross-process request to load font. |
80 WebSandboxSupport* sandboxSupport = Platform::current()->sandboxSupport(); | 80 WebSandboxSupport* sandboxSupport = Platform::current()->sandboxSupport(); |
81 if (!sandboxSupport) { | 81 if (!sandboxSupport) { |
82 // This function should only be called in response to an error loading a | 82 // This function should only be called in response to an error loading a |
83 // font due to being blocked by the sandbox. | 83 // font due to being blocked by the sandbox. |
84 // This by definition shouldn't happen if there is no sandbox support. | 84 // This by definition shouldn't happen if there is no sandbox support. |
85 ASSERT_NOT_REACHED(); | 85 NOTREACHED(); |
86 return nullptr; | 86 return nullptr; |
87 } | 87 } |
88 | 88 |
89 CGFontRef loadedCgFont; | 89 CGFontRef loadedCgFont; |
90 uint32_t fontID; | 90 uint32_t fontID; |
91 if (!sandboxSupport->loadFont(nsFont, &loadedCgFont, &fontID)) { | 91 if (!sandboxSupport->loadFont(nsFont, &loadedCgFont, &fontID)) { |
92 // TODO crbug.com/461279: Make this appear in the inspector console? | 92 // TODO crbug.com/461279: Make this appear in the inspector console? |
93 DLOG(ERROR) | 93 DLOG(ERROR) |
94 << "Loading user font \"" << [[nsFont familyName] UTF8String] | 94 << "Loading user font \"" << [[nsFont familyName] UTF8String] |
95 << "\" from non system location failed. Corrupt or missing font file?"; | 95 << "\" from non system location failed. Corrupt or missing font file?"; |
(...skipping 95 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 |