OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module font_service; | 5 module font_service; |
6 | 6 |
7 enum TypefaceStyle { | 7 enum TypefaceSlant { |
8 NORMAL = 0, | 8 ROMAN = 0, |
9 BOLD = 0x01, | 9 ITALIC = 1, |
10 ITALIC = 0x02, | 10 }; |
11 BOLD_ITALIC = 0x03 | 11 struct TypefaceStyle { |
Elliot Glaysher
2016/04/11 18:04:41
one line of whitespace between the enum and the st
bungeman-chromium
2016/04/11 18:29:22
Done.
| |
12 uint16 weight; | |
13 uint8 width; | |
14 TypefaceSlant slant; | |
12 }; | 15 }; |
13 | 16 |
14 // A reference to specific font on the font service. | 17 // A reference to specific font on the font service. |
15 struct FontIdentity { | 18 struct FontIdentity { |
16 uint32 id; | 19 uint32 id; |
17 int32 ttc_index; | 20 int32 ttc_index; |
18 // TODO(erg): So the string is supposed to be a path. However, the current | 21 // TODO(erg): So the string is supposed to be a path. However, the current |
19 // chrome code goes out of its way to send this to the renderer process, and | 22 // chrome code goes out of its way to send this to the renderer process, and |
20 // it is passed to blink, even though the openStream() IPC in chrome uses the | 23 // it is passed to blink, even though the openStream() IPC in chrome uses the |
21 // id number instead. Do more investigation about what we need to do to plug | 24 // id number instead. Do more investigation about what we need to do to plug |
22 // this system path leak. | 25 // this system path leak. |
23 string str_representation; | 26 string str_representation; |
24 }; | 27 }; |
25 | 28 |
26 // Loads and resolves fonts. | 29 // Loads and resolves fonts. |
27 // | 30 // |
28 // We still need to load fonts from within a sandboxed process. We set | 31 // We still need to load fonts from within a sandboxed process. We set |
29 // up a service to match fonts and load them, | 32 // up a service to match fonts and load them, |
30 interface FontService { | 33 interface FontService { |
31 // Returns the best match for |family_name| and |style|. On error, returns a | 34 // Returns the best match for |family_name| and |style|. On error, returns a |
32 // null |identity|. | 35 // null |identity|. |
33 MatchFamilyName(string family_name, TypefaceStyle style) => | 36 MatchFamilyName(string family_name, TypefaceStyle style) => |
34 (FontIdentity? identity, string family_name, TypefaceStyle style); | 37 (FontIdentity? identity, string family_name, TypefaceStyle style); |
35 | 38 |
36 // Returns a handle to the raw font specified by |id_number|. | 39 // Returns a handle to the raw font specified by |id_number|. |
37 OpenStream(uint32 id_number) => (handle font_handle); | 40 OpenStream(uint32 id_number) => (handle font_handle); |
38 }; | 41 }; |
OLD | NEW |