![]() a \`.webfontrc \` file (with or without filename extension: a \`webfont \` property in \`package.json \` If no \`-config \` argument is provided, webfont will search forĬonfiguration files in the following places, in this order: Or the name of a module in \`node_modules \` that points to one. ![]() config Path to a specific configuration file (JSON, YAML, or CommonJS) Webfont -help prints the CLI documentation. The interface for command-line usage is fairly simplistic at this stage, as seen in the following usage section. cssTemplateFontNameĭefault value getting from fontName options, but you can specify any value. cssTemplateClassNameĭefault font class name. Possible values: css, scss (feel free to contribute). If not passed srcCssTemplate, then it takes from template directory. Possible values: svg, ttf, eot, woff, woff2. Node_modules and bower_components are always ignored. Ultimately passed to node-glob to figure out what files you want to lint. For fonts loaded from a provider that does not support the current browser, the fontinactive event will be triggered.Const webfont = require ( 'webfont' ) webfont ( ) Options filesĪ file glob, or array of file globs. When finished, the active event will be triggered.įor fonts loaded from supported providers, the fontactive event will be triggered. If Web Font Loader determines that the current browser can support and at least one provider is able to serve fonts, the fonts from that provider will be loaded. When loading fonts from multiple providers, each provider may or may not support a given browser. If Web Font Loader determines that the current browser does not support the inactive event will be triggered. Web font providers can build on top of the basic Web Font Loader functionality to handle these special cases individually. ![]() The Web Font Loader is not designed to handle these cases and it defaults to believing what's in the user agent string. In this case a web font provider may decide to send WOFF fonts to the device because the real desktop Chrome supports it, while the mobile browser does not. This is especially noticeable on mobile browsers with a "Desktop" mode, which usually identify as Chrome on Linux. The user agent string may claim to support a web font format when it in fact does not. Browser SupportĮvery web browser has varying levels of support for fonts linked via Web Font Loader determines support for web fonts is using the browser's user agent string. If you're using Typekit, you should use their embed codes directly unless you also need to load web fonts from other providers on the same page. The following classes are set on the html element:įYI: Typekit's own JavaScript is built using the Web Font Loader library and already provides all of the same font event functionality. fontinactive - This event is triggered if the font can't be loaded.ĬSS events are implemented as classes on the html element.fontactive - This event is triggered once for each font that renders.fontloading - This event is triggered once for each font that's loaded.inactive - This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded.active - This event is triggered when the fonts have rendered. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |