| 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> |
| 2 |
| 3 <h2 id="manifest">Manifest</h2> | 3 <h2 id="manifest">Manifest</h2> |
| 4 <p>To use the Font Settings API, you must declare the "fontSettings" permission | 4 <p>To use the Font Settings API, you must declare the "fontSettings" permission |
| 5 in the <a href="manifest.html">extension manifest</a>. | 5 in the <a href="manifest.html">extension manifest</a>. |
| 6 For example:</p> | 6 For example:</p> |
| 7 <pre>{ | 7 <pre>{ |
| 8 "name": "My Font Settings Extension", | 8 "name": "My Font Settings Extension", |
| 9 "description": "Customize your fonts", | 9 "description": "Customize your fonts", |
| 10 "version": "0.2", | 10 "version": "0.2", |
| 11 "permissions": ["fontSettings"] | 11 "permissions": ["fontSettings"] |
| 12 }</pre> | 12 }</pre> |
| 13 |
| 13 <h2 id="scripts">Generic Font Families and Scripts</h2> | 14 <h2 id="scripts">Generic Font Families and Scripts</h2> |
| 14 <p>Chrome allows for some font settings to depend on certain generic font | 15 <p>Chrome allows for some font settings to depend on certain generic font |
| 15 families and language scripts. For example, the font used for sans-serif | 16 families and language scripts. For example, the font used for sans-serif |
| 16 Simplified Chinese may be different than the font used for serif Japanese.</p> | 17 Simplified Chinese may be different than the font used for serif Japanese.</p> |
| 18 |
| 17 <p>The generic font families supported by Chrome are based on | 19 <p>The generic font families supported by Chrome are based on |
| 18 <a href="http://www.w3.org/TR/CSS21/fonts.html#generic-font-families">CSS generi
c font families</a> | 20 <a href="http://www.w3.org/TR/CSS21/fonts.html#generic-font-families">CSS generi
c font families</a> |
| 19 and are listed in the API reference below. When a webpage specifies a generic | 21 and are listed in the API reference below. When a webpage specifies a generic |
| 20 font family, Chrome selects the font based on the corresponding setting. If no | 22 font family, Chrome selects the font based on the corresponding setting. If no |
| 21 generic font family is specified, Chrome uses the setting for the "standard" | 23 generic font family is specified, Chrome uses the setting for the "standard" |
| 22 generic font family.</p> | 24 generic font family.</p> |
| 25 |
| 23 <p>When a webpage specifies a language, Chrome selects the font based on the | 26 <p>When a webpage specifies a language, Chrome selects the font based on the |
| 24 setting for the corresponding language script. If no language is specified, | 27 setting for the corresponding language script. If no language is specified, |
| 25 Chrome uses the setting for the default, or global, script.</p> | 28 Chrome uses the setting for the default, or global, script.</p> |
| 29 |
| 26 <p>The supported language scripts are specified by ISO 15924 script code and | 30 <p>The supported language scripts are specified by ISO 15924 script code and |
| 27 listed in the API reference below. Technically, Chrome settings are not strictly | 31 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 | 32 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 | 33 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 | 34 language, and uses this font not just for Cyrillic script but for everything the |
| 31 font covers, such as Latin.</p> | 35 font covers, such as Latin.</p> |
| 36 |
| 32 <h2 id="examples">Examples</h2> | 37 <h2 id="examples">Examples</h2> |
| 33 <p>The following code gets the standard font for Arabic.</p> | 38 <p>The following code gets the standard font for Arabic.</p> |
| 34 <pre> | 39 <pre> |
| 35 chrome.fontSettings.getFont( | 40 chrome.fontSettings.getFont( |
| 36 { genericFamily: 'standard', script: 'Arab' }, | 41 { genericFamily: 'standard', script: 'Arab' }, |
| 37 function(details) { console.log(details.fontName); } | 42 function(details) { console.log(details.fontId); } |
| 38 ); | 43 ); |
| 39 </pre> | 44 </pre> |
| 45 |
| 40 <p>The next snippet sets the sans-serif font for Japanese.</p> | 46 <p>The next snippet sets the sans-serif font for Japanese.</p> |
| 41 <pre> | 47 <pre> |
| 42 chrome.fontSettings.setFont( | 48 chrome.fontSettings.setFont( |
| 43 { genericFamily: 'sansserif', script: 'Jpan', fontName: 'MS PGothic' } | 49 { genericFamily: 'sansserif', script: 'Jpan', fontId: 'MS PGothic' } |
| 44 ); | 50 ); |
| 45 </pre> | 51 </pre> |
| 52 |
| 46 <p>You can find a sample extension using the Font Settings API in the | 53 <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> | 54 <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 | 55 directory. For other examples and for help in viewing the source code, see |
| 49 <a href="samples.html">Samples</a>.</p> | 56 <a href="samples.html">Samples</a>.</p> |
| 50 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |