ChromeFontSettings class
class ChromeFontSettings extends ChromeApi { static final JsObject _fontSettings = chrome['fontSettings']; ChromeFontSettings._(); bool get available => _fontSettings != null; /** * Clears the font set by this extension, if any. */ Future clearFont(FontSettingsClearFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearFont', [jsify(details), completer.callback]); return completer.future; } /** * Gets the font for a given script and generic font family. */ Future<Map> getFont(FontSettingsGetFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getFont', [jsify(details), completer.callback]); return completer.future; } /** * Sets the font for a given script and generic font family. */ Future setFont(FontSettingsSetFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setFont', [jsify(details), completer.callback]); return completer.future; } /** * Gets a list of fonts on the system. */ Future<List<FontName>> getFontList() { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<List<FontName>>.oneArg((e) => listify(e, _createFontName)); _fontSettings.callMethod('getFontList', [completer.callback]); return completer.future; } /** * Clears the default font size set by this extension, if any. * * [details] This parameter is currently unused. */ Future clearDefaultFontSize([FontSettingsClearDefaultFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearDefaultFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Gets the default font size. * * [details] This parameter is currently unused. */ Future<Map> getDefaultFontSize([FontSettingsGetDefaultFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getDefaultFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Sets the default font size. */ Future setDefaultFontSize(FontSettingsSetDefaultFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setDefaultFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Clears the default fixed font size set by this extension, if any. * * [details] This parameter is currently unused. */ Future clearDefaultFixedFontSize([FontSettingsClearDefaultFixedFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Gets the default size for fixed width fonts. * * [details] This parameter is currently unused. */ Future<Map> getDefaultFixedFontSize([FontSettingsGetDefaultFixedFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Sets the default size for fixed width fonts. */ Future setDefaultFixedFontSize(FontSettingsSetDefaultFixedFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Clears the minimum font size set by this extension, if any. * * [details] This parameter is currently unused. */ Future clearMinimumFontSize([FontSettingsClearMinimumFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearMinimumFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Gets the minimum font size. * * [details] This parameter is currently unused. */ Future<Map> getMinimumFontSize([FontSettingsGetMinimumFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getMinimumFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Sets the minimum font size. */ Future setMinimumFontSize(FontSettingsSetMinimumFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setMinimumFontSize', [jsify(details), completer.callback]); return completer.future; } /** * Fired when a font setting changes. */ Stream<Map> get onFontChanged => _onFontChanged.stream; final ChromeStreamController<Map> _onFontChanged = new ChromeStreamController<Map>.oneArg(_fontSettings, 'onFontChanged', mapify); /** * Fired when the default font size setting changes. */ Stream<Map> get onDefaultFontSizeChanged => _onDefaultFontSizeChanged.stream; final ChromeStreamController<Map> _onDefaultFontSizeChanged = new ChromeStreamController<Map>.oneArg(_fontSettings, 'onDefaultFontSizeChanged', mapify); /** * Fired when the default fixed font size setting changes. */ Stream<Map> get onDefaultFixedFontSizeChanged => _onDefaultFixedFontSizeChanged.stream; final ChromeStreamController<Map> _onDefaultFixedFontSizeChanged = new ChromeStreamController<Map>.oneArg(_fontSettings, 'onDefaultFixedFontSizeChanged', mapify); /** * Fired when the minimum font size setting changes. */ Stream<Map> get onMinimumFontSizeChanged => _onMinimumFontSizeChanged.stream; final ChromeStreamController<Map> _onMinimumFontSizeChanged = new ChromeStreamController<Map>.oneArg(_fontSettings, 'onMinimumFontSizeChanged', mapify); void _throwNotAvailable() { throw new UnsupportedError("'chrome.fontSettings' is not available"); } }
Extends
ChromeApi > ChromeFontSettings
Properties
final bool available #
Returns true if the API is available. The common causes of an API not being avilable are:
- a permission is missing in the application's manifest.json file
- the API is defined on a newer version of Chrome then the current runtime
bool get available => _fontSettings != null;
final Stream<Map> onDefaultFixedFontSizeChanged #
Fired when the default fixed font size setting changes.
Stream<Map> get onDefaultFixedFontSizeChanged => _onDefaultFixedFontSizeChanged.stream;
final Stream<Map> onDefaultFontSizeChanged #
Fired when the default font size setting changes.
Stream<Map> get onDefaultFontSizeChanged => _onDefaultFontSizeChanged.stream;
final Stream<Map> onFontChanged #
Fired when a font setting changes.
Stream<Map> get onFontChanged => _onFontChanged.stream;
final Stream<Map> onMinimumFontSizeChanged #
Fired when the minimum font size setting changes.
Stream<Map> get onMinimumFontSizeChanged => _onMinimumFontSizeChanged.stream;
Methods
Future clearDefaultFixedFontSize([FontSettingsClearDefaultFixedFontSizeParams details]) #
Clears the default fixed font size set by this extension, if any.
details This parameter is currently unused.
Future clearDefaultFixedFontSize([FontSettingsClearDefaultFixedFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; }
Future clearDefaultFontSize([FontSettingsClearDefaultFontSizeParams details]) #
Clears the default font size set by this extension, if any.
details This parameter is currently unused.
Future clearDefaultFontSize([FontSettingsClearDefaultFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearDefaultFontSize', [jsify(details), completer.callback]); return completer.future; }
Future clearFont(FontSettingsClearFontParams details) #
Clears the font set by this extension, if any.
Future clearFont(FontSettingsClearFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearFont', [jsify(details), completer.callback]); return completer.future; }
Future clearMinimumFontSize([FontSettingsClearMinimumFontSizeParams details]) #
Clears the minimum font size set by this extension, if any.
details This parameter is currently unused.
Future clearMinimumFontSize([FontSettingsClearMinimumFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('clearMinimumFontSize', [jsify(details), completer.callback]); return completer.future; }
Future<Map> getDefaultFixedFontSize([FontSettingsGetDefaultFixedFontSizeParams details]) #
Gets the default size for fixed width fonts.
details This parameter is currently unused.
Future<Map> getDefaultFixedFontSize([FontSettingsGetDefaultFixedFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; }
Future<Map> getDefaultFontSize([FontSettingsGetDefaultFontSizeParams details]) #
Gets the default font size.
details This parameter is currently unused.
Future<Map> getDefaultFontSize([FontSettingsGetDefaultFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getDefaultFontSize', [jsify(details), completer.callback]); return completer.future; }
Future<Map> getFont(FontSettingsGetFontParams details) #
Gets the font for a given script and generic font family.
Future<Map> getFont(FontSettingsGetFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getFont', [jsify(details), completer.callback]); return completer.future; }
Future<List<FontName>> getFontList() #
Gets a list of fonts on the system.
Future<List<FontName>> getFontList() { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<List<FontName>>.oneArg((e) => listify(e, _createFontName)); _fontSettings.callMethod('getFontList', [completer.callback]); return completer.future; }
Future<Map> getMinimumFontSize([FontSettingsGetMinimumFontSizeParams details]) #
Gets the minimum font size.
details This parameter is currently unused.
Future<Map> getMinimumFontSize([FontSettingsGetMinimumFontSizeParams details]) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter<Map>.oneArg(mapify); _fontSettings.callMethod('getMinimumFontSize', [jsify(details), completer.callback]); return completer.future; }
Future setDefaultFixedFontSize(FontSettingsSetDefaultFixedFontSizeParams details) #
Sets the default size for fixed width fonts.
Future setDefaultFixedFontSize(FontSettingsSetDefaultFixedFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setDefaultFixedFontSize', [jsify(details), completer.callback]); return completer.future; }
Future setDefaultFontSize(FontSettingsSetDefaultFontSizeParams details) #
Sets the default font size.
Future setDefaultFontSize(FontSettingsSetDefaultFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setDefaultFontSize', [jsify(details), completer.callback]); return completer.future; }
Future setFont(FontSettingsSetFontParams details) #
Sets the font for a given script and generic font family.
Future setFont(FontSettingsSetFontParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setFont', [jsify(details), completer.callback]); return completer.future; }
Future setMinimumFontSize(FontSettingsSetMinimumFontSizeParams details) #
Sets the minimum font size.
Future setMinimumFontSize(FontSettingsSetMinimumFontSizeParams details) { if (_fontSettings == null) _throwNotAvailable(); var completer = new ChromeCompleter.noArgs(); _fontSettings.callMethod('setMinimumFontSize', [jsify(details), completer.callback]); return completer.future; }