OLD | NEW |
1 <!-- BEGIN AUTHORED CONTENT --> | |
2 <p>The Font Settings API allows you to manage Chrome's font settings.</p> | 1 <p>The Font Settings API allows you to manage Chrome's font settings.</p> |
3 <h2 id="manifest">Manifest</h2> | 2 <h2 id="manifest">Manifest</h2> |
4 <p>To use the Font Settings API, you must declare the "fontSettings" permission | 3 <p>To use the Font Settings API, you must declare the "fontSettings" permission |
5 in the <a href="manifest.html">extension manifest</a>. | 4 in the <a href="manifest.html">extension manifest</a>. |
6 For example:</p> | 5 For example:</p> |
7 <pre>{ | 6 <pre>{ |
8 "name": "My Font Settings Extension", | 7 "name": "My Font Settings Extension", |
9 "description": "Customize your fonts", | 8 "description": "Customize your fonts", |
10 "version": "0.2", | 9 "version": "0.2", |
11 "permissions": ["fontSettings"] | 10 "permissions": ["fontSettings"] |
(...skipping 15 matching lines...) Expand all Loading... |
27 listed in the API reference below. Technically, Chrome settings are not strictly | 26 listed in the API reference below. Technically, Chrome settings are not strictly |
28 per-script but also depend on language. For example, Chrome chooses the font for | 27 per-script but also depend on language. For example, Chrome chooses the font for |
29 Cyrillic (ISO 15924 script code "Cyrl") when a webpage specifies the Russian | 28 Cyrillic (ISO 15924 script code "Cyrl") when a webpage specifies the Russian |
30 language, and uses this font not just for Cyrillic script but for everything the | 29 language, and uses this font not just for Cyrillic script but for everything the |
31 font covers, such as Latin.</p> | 30 font covers, such as Latin.</p> |
32 <h2 id="examples">Examples</h2> | 31 <h2 id="examples">Examples</h2> |
33 <p>The following code gets the standard font for Arabic.</p> | 32 <p>The following code gets the standard font for Arabic.</p> |
34 <pre> | 33 <pre> |
35 chrome.fontSettings.getFont( | 34 chrome.fontSettings.getFont( |
36 { genericFamily: 'standard', script: 'Arab' }, | 35 { genericFamily: 'standard', script: 'Arab' }, |
37 function(details) { console.log(details.fontName); } | 36 function(details) { console.log(details.fontId); } |
38 ); | 37 ); |
39 </pre> | 38 </pre> |
40 <p>The next snippet sets the sans-serif font for Japanese.</p> | 39 <p>The next snippet sets the sans-serif font for Japanese.</p> |
41 <pre> | 40 <pre> |
42 chrome.fontSettings.setFont( | 41 chrome.fontSettings.setFont( |
43 { genericFamily: 'sansserif', script: 'Jpan', fontName: 'MS PGothic' } | 42 { genericFamily: 'sansserif', script: 'Jpan', fontId: 'MS PGothic' } |
44 ); | 43 ); |
45 </pre> | 44 </pre> |
46 <p>You can find a sample extension using the Font Settings API in the | 45 <p>You can find a sample extension using the Font Settings API in the |
47 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/fontSettings/">examples/api/fontSettings</a> | 46 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/fontSettings/">examples/api/fontSettings</a> |
48 directory. For other examples and for help in viewing the source code, see | 47 directory. For other examples and for help in viewing the source code, see |
49 <a href="samples.html">Samples</a>.</p> | 48 <a href="samples.html">Samples</a>.</p> |
50 <!-- END AUTHORED CONTENT --> | |
OLD | NEW |