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* ns_font, | 77 static sk_sp<SkTypeface> LoadFromBrowserProcess(NSFont* ns_font, |
78 float text_size) { | 78 float text_size) { |
79 // Send cross-process request to load font. | 79 // Send cross-process request to load font. |
80 WebSandboxSupport* sandbox_support = Platform::Current()->GetSandboxSupport(); | 80 WebSandboxSupport* sandbox_support = Platform::Current()->GetSandboxSupport(); |
81 if (!sandbox_support) { | 81 if (!sandbox_support) { |
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 loaded_cg_font; | 89 CGFontRef loaded_cg_font; |
90 uint32_t font_id; | 90 uint32_t font_id; |
91 if (!sandbox_support->LoadFont(ns_font, &loaded_cg_font, &font_id)) { | 91 if (!sandbox_support->LoadFont(ns_font, &loaded_cg_font, &font_id)) { |
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 \"" << [[ns_font familyName] UTF8String] | 94 << "Loading user font \"" << [[ns_font 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 typeface_ = sk_sp<SkTypeface>(fm->createFromStream( | 194 typeface_ = sk_sp<SkTypeface>(fm->createFromStream( |
195 typeface_->openStream(nullptr)->duplicate(), | 195 typeface_->openStream(nullptr)->duplicate(), |
196 SkFontMgr::FontParameters().setAxes(axes, variation_settings->size()))); | 196 SkFontMgr::FontParameters().setAxes(axes, variation_settings->size()))); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 } // namespace blink | 200 } // namespace blink |
OLD | NEW |