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