Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 [
      6   {
      7     "namespace": "fontSettings",
      8     "description": "Use the <code>chrome.fontSettings</code> API to manage Chrome's font settings.",
      9     "documentation_permissions_required": ["fontSettings"],
     10     "types": [
     11       {
     12         "id": "FontName",
     13         "type": "object",
     14         "description": "Represents a font name.",
     15         "properties": {
     16           "fontId": {
     17             "type": "string",
     18             "description": "The font ID."
     19           },
     20           "displayName": {
     21             "type": "string",
     22             "description": "The display name of the font."
     23           }
     24         }
     25       },
     26       {
     27         "id": "ScriptCode",
     28         "type": "string",
     29         "enum": [ "Afak", "Arab", "Armi", "Armn", "Avst", "Bali", "Bamu", "Bass", "Batk",
     30                   "Beng", "Blis", "Bopo", "Brah", "Brai", "Bugi", "Buhd", "Cakm", "Cans",
     31                   "Cari", "Cham", "Cher", "Cirt", "Copt", "Cprt", "Cyrl", "Cyrs", "Deva",
     32                   "Dsrt", "Dupl", "Egyd", "Egyh", "Egyp", "Elba", "Ethi", "Geor", "Geok",
     33                   "Glag", "Goth", "Gran", "Grek", "Gujr", "Guru", "Hang", "Hani", "Hano",
     34                   "Hans", "Hant", "Hebr", "Hluw", "Hmng", "Hung", "Inds", "Ital", "Java",
     35                   "Jpan", "Jurc", "Kali", "Khar", "Khmr", "Khoj", "Knda", "Kpel", "Kthi",
     36                   "Lana", "Laoo", "Latf", "Latg", "Latn", "Lepc", "Limb", "Lina", "Linb",
     37                   "Lisu", "Loma", "Lyci", "Lydi", "Mand", "Mani", "Maya", "Mend", "Merc",
     38                   "Mero", "Mlym", "Moon", "Mong", "Mroo", "Mtei", "Mymr", "Narb", "Nbat",
     39                   "Nkgb", "Nkoo", "Nshu", "Ogam", "Olck", "Orkh", "Orya", "Osma", "Palm",
     40                   "Perm", "Phag", "Phli", "Phlp", "Phlv", "Phnx", "Plrd", "Prti", "Rjng",
     41                   "Roro", "Runr", "Samr", "Sara", "Sarb", "Saur", "Sgnw", "Shaw", "Shrd",
     42                   "Sind", "Sinh", "Sora", "Sund", "Sylo", "Syrc", "Syre", "Syrj", "Syrn",
     43                   "Tagb", "Takr", "Tale", "Talu", "Taml", "Tang", "Tavt", "Telu", "Teng",
     44                   "Tfng", "Tglg", "Thaa", "Thai", "Tibt", "Tirh", "Ugar", "Vaii", "Visp",
     45                   "Wara", "Wole", "Xpeo", "Xsux", "Yiii", "Zmth", "Zsym", "Zyyy" ],
     46         "description": "An ISO 15924 script code. The default, or global, script is represented by script code \"Zyyy\"."
     47       },
     48       {
     49         "id": "GenericFamily",
     50         "type": "string",
     51         "enum": ["standard", "sansserif", "serif", "fixed", "cursive", "fantasy"],
     52         "description": "A CSS generic font family."
     53       },
     54       {
     55         "id": "LevelOfControl",
     56         "description": "One of<br><var>not_controllable</var>: cannot be controlled by any extension<br><var>controlled_by_other_extensions</var>: controlled by extensions with higher precedence<br><var>controllable_by_this_extension</var>: can be controlled by this extension<br><var>controlled_by_this_extension</var>: controlled by this extension",
     57         "type": "string",
     58         "enum": ["not_controllable", "controlled_by_other_extensions", "controllable_by_this_extension", "controlled_by_this_extension"]
     59       }
     60     ],
     61     "functions": [
     62       {
     63         "name": "clearFont",
     64         "description": "Clears the font set by this extension, if any.",
     65         "parameters": [
     66           {
     67             "name": "details",
     68             "type": "object",
     69             "properties": {
     70               "script": {
     71                 "$ref": "ScriptCode",
     72                 "description": "The script for which the font should be cleared. If omitted, the global script font setting is cleared.",
     73                 "optional": true
     74               },
     75               "genericFamily": {
     76                 "$ref": "GenericFamily",
     77                 "description": "The generic font family for which the font should be cleared."
     78               }
     79             }
     80           },
     81           {
     82             "type": "function",
     83             "name": "callback",
     84             "optional": true,
     85             "parameters": []
     86           }
     87         ]
     88       },
     89       {
     90         "name": "getFont",
     91         "description": "Gets the font for a given script and generic font family.",
     92         "parameters": [
     93           {
     94             "name": "details",
     95             "type": "object",
     96             "properties": {
     97               "script": {
     98                 "$ref": "ScriptCode",
     99                 "description": "The script for which the font should be retrieved. If omitted, the font setting for the global script (script code \"Zyyy\") is retrieved.",
    100                 "optional": true
    101               },
    102               "genericFamily": {
    103                 "$ref": "GenericFamily",
    104                 "description": "The generic font family for which the font should be retrieved."
    105               }
    106             }
    107           },
    108           {
    109             "type": "function",
    110             "name": "callback",
    111             "optional": true,
    112             "parameters": [
    113               {
    114                 "name": "details",
    115                 "type": "object",
    116                 "properties": {
    117                   "fontId": {
    118                     "type": "string",
    119                     "description": "The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, <var>fontId</var> can differ from the font passed to <code>setFont</code>, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting."
    120                   },
    121                   "levelOfControl": {
    122                     "$ref": "LevelOfControl",
    123                     "description": "The level of control this extension has over the setting."
    124                   }
    125                 }
    126               }
    127             ]
    128           }
    129         ]
    130       },
    131       {
    132         "name": "setFont",
    133         "description": "Sets the font for a given script and generic font family.",
    134         "parameters": [
    135           {
    136             "name": "details",
    137             "type": "object",
    138             "properties": {
    139               "script": {
    140                 "$ref": "ScriptCode",
    141                 "description": "The script code which the font should be set. If omitted, the font setting for the global script (script code \"Zyyy\") is set.",
    142                 "optional": true
    143               },
    144               "genericFamily": {
    145                 "$ref": "GenericFamily",
    146                 "description": "The generic font family for which the font should be set."
    147               },
    148               "fontId": {
    149                 "type": "string",
    150                 "description": "The font ID. The empty string means to fallback to the global script font setting."
    151               }
    152             }
    153           },
    154           {
    155             "type": "function",
    156             "name": "callback",
    157             "optional": true,
    158             "parameters": []
    159           }
    160         ]
    161       },
    162       {
    163         "name": "getFontList",
    164         "description": "Gets a list of fonts on the system.",
    165         "parameters": [
    166           {
    167             "type": "function",
    168             "name": "callback",
    169             "parameters": [
    170               {
    171                 "name": "results",
    172                 "type": "array",
    173                 "items": { "$ref": "FontName" }
    174               }
    175             ]
    176           }
    177         ]
    178       },
    179       {
    180         "name": "clearDefaultFontSize",
    181         "description": "Clears the default font size set by this extension, if any.",
    182         "parameters": [
    183           {
    184             "name": "details",
    185             "type": "object",
    186             "optional": true,
    187             "description": "This parameter is currently unused.",
    188             "properties": {}
    189           },
    190           {
    191             "type": "function",
    192             "name": "callback",
    193             "optional": true,
    194             "parameters": []
    195           }
    196         ]
    197       },
    198       {
    199         "name": "getDefaultFontSize",
    200         "description": "Gets the default font size.",
    201         "parameters": [
    202           {
    203             "name": "details",
    204             "type": "object",
    205             "optional": true,
    206             "description": "This parameter is currently unused.",
    207             "properties": {}
    208           },
    209           {
    210             "name": "callback",
    211             "type": "function",
    212             "optional": true,
    213             "parameters": [
    214               {
    215                 "name": "details",
    216                 "type": "object",
    217                 "properties": {
    218                   "pixelSize": {
    219                     "type": "integer",
    220                     "description": "The font size in pixels."
    221                   },
    222                   "levelOfControl": {
    223                     "$ref": "LevelOfControl",
    224                     "description": "The level of control this extension has over the setting."
    225                   }
    226                 }
    227               }
    228             ]
    229           }
    230         ]
    231       },
    232       {
    233         "name": "setDefaultFontSize",
    234         "description": "Sets the default font size.",
    235         "parameters": [
    236           {
    237             "name": "details",
    238             "type": "object",
    239             "properties": {
    240               "pixelSize": {
    241                 "type": "integer",
    242                 "description": "The font size in pixels."
    243               }
    244             }
    245           },
    246           {
    247             "type": "function",
    248             "name": "callback",
    249             "optional": true,
    250             "parameters": []
    251           }
    252         ]
    253       },
    254       {
    255         "name": "clearDefaultFixedFontSize",
    256         "description": "Clears the default fixed font size set by this extension, if any.",
    257         "parameters": [
    258           {
    259             "name": "details",
    260             "type": "object",
    261             "optional": true,
    262             "description": "This parameter is currently unused.",
    263             "properties": {}
    264           },
    265           {
    266             "type": "function",
    267             "name": "callback",
    268             "optional": true,
    269             "parameters": []
    270           }
    271         ]
    272       },
    273       {
    274         "name": "getDefaultFixedFontSize",
    275         "description": "Gets the default size for fixed width fonts.",
    276         "parameters": [
    277           {
    278             "name": "details",
    279             "type": "object",
    280             "optional": true,
    281             "description": "This parameter is currently unused.",
    282             "properties": {}
    283           },
    284           {
    285             "name": "callback",
    286             "type": "function",
    287             "optional": true,
    288             "parameters": [
    289               {
    290                 "name": "details",
    291                 "type": "object",
    292                 "properties": {
    293                   "pixelSize": {
    294                     "type": "integer",
    295                     "description": "The font size in pixels."
    296                   },
    297                   "levelOfControl": {
    298                     "$ref": "LevelOfControl",
    299                     "description": "The level of control this extension has over the setting."
    300                   }
    301                 }
    302               }
    303             ]
    304           }
    305         ]
    306       },
    307       {
    308         "name": "setDefaultFixedFontSize",
    309         "description": "Sets the default size for fixed width fonts.",
    310         "parameters": [
    311           {
    312             "name": "details",
    313             "type": "object",
    314             "properties": {
    315               "pixelSize": {
    316                 "type": "integer",
    317                 "description": "The font size in pixels."
    318               }
    319             }
    320           },
    321           {
    322             "type": "function",
    323             "name": "callback",
    324             "optional": true,
    325             "parameters": []
    326           }
    327         ]
    328       },
    329       {
    330         "name": "clearMinimumFontSize",
    331         "description": "Clears the minimum font size set by this extension, if any.",
    332         "parameters": [
    333           {
    334             "name": "details",
    335             "type": "object",
    336             "optional": true,
    337             "description": "This parameter is currently unused.",
    338             "properties": {}
    339           },
    340           {
    341             "type": "function",
    342             "name": "callback",
    343             "optional": true,
    344             "parameters": []
    345           }
    346         ]
    347       },
    348       {
    349         "name": "getMinimumFontSize",
    350         "description": "Gets the minimum font size.",
    351         "parameters": [
    352           {
    353             "name": "details",
    354             "type": "object",
    355             "optional": true,
    356             "description": "This parameter is currently unused.",
    357             "properties": {}
    358           },
    359           {
    360             "name": "callback",
    361             "type": "function",
    362             "optional": true,
    363             "parameters": [
    364               {
    365                 "name": "details",
    366                 "type": "object",
    367                 "properties": {
    368                   "pixelSize": {
    369                     "type": "integer",
    370                     "description": "The font size in pixels."
    371                   },
    372                   "levelOfControl": {
    373                     "$ref": "LevelOfControl",
    374                     "description": "The level of control this extension has over the setting."
    375                   }
    376                 }
    377               }
    378             ]
    379           }
    380         ]
    381       },
    382       {
    383         "name": "setMinimumFontSize",
    384         "description": "Sets the minimum font size.",
    385         "parameters": [
    386           {
    387             "name": "details",
    388             "type": "object",
    389             "properties": {
    390               "pixelSize": {
    391                 "type": "integer",
    392                 "description": "The font size in pixels."
    393               }
    394             }
    395           },
    396           {
    397             "type": "function",
    398             "name": "callback",
    399             "optional": true,
    400             "parameters": []
    401           }
    402         ]
    403       }
    404     ],
    405     "events": [
    406       {
    407         "name": "onFontChanged",
    408         "description": "Fired when a font setting changes.",
    409         "parameters": [
    410           {
    411             "type": "object",
    412             "name": "details",
    413             "properties": {
    414               "fontId": {
    415                 "type": "string",
    416                 "description": "The font ID. See the description in <code>getFont</code>."
    417               },
    418               "script": {
    419                 "$ref": "ScriptCode",
    420                 "description": "The script code for which the font setting has changed.",
    421                 "optional": true
    422               },
    423               "genericFamily": {
    424                 "$ref": "GenericFamily",
    425                 "description": "The generic font family for which the font setting has changed."
    426               },
    427               "levelOfControl": {
    428                 "$ref": "LevelOfControl",
    429                 "description": "The level of control this extension has over the setting."
    430               }
    431             }
    432           }
    433         ]
    434       },
    435       {
    436         "name": "onDefaultFontSizeChanged",
    437         "description": "Fired when the default font size setting changes.",
    438         "parameters": [
    439           {
    440             "type": "object",
    441             "name": "details",
    442             "properties": {
    443               "pixelSize": {
    444                 "type": "integer",
    445                 "description": "The font size in pixels."
    446               },
    447               "levelOfControl": {
    448                 "$ref": "LevelOfControl",
    449                 "description": "The level of control this extension has over the setting."
    450               }
    451             }
    452           }
    453         ]
    454       },
    455       {
    456         "name": "onDefaultFixedFontSizeChanged",
    457         "description": "Fired when the default fixed font size setting changes.",
    458         "parameters": [
    459           {
    460             "type": "object",
    461             "name": "details",
    462             "properties": {
    463               "pixelSize": {
    464                 "type": "integer",
    465                 "description": "The font size in pixels."
    466               },
    467               "levelOfControl": {
    468                 "$ref": "LevelOfControl",
    469                 "description": "The level of control this extension has over the setting."
    470               }
    471             }
    472           }
    473         ]
    474       },
    475       {
    476         "name": "onMinimumFontSizeChanged",
    477         "description": "Fired when the minimum font size setting changes.",
    478         "parameters": [
    479           {
    480             "type": "object",
    481             "name": "details",
    482             "properties": {
    483               "pixelSize": {
    484                 "type": "integer",
    485                 "description": "The font size in pixels."
    486               },
    487               "levelOfControl": {
    488                 "$ref": "LevelOfControl",
    489                 "description": "The level of control this extension has over the setting."
    490               }
    491             }
    492           }
    493         ]
    494       }
    495     ]
    496   }
    497 ]
    498