How to use the webfont.getFontBySlug function in webfont

To help you get started, we’ve selected a few webfont examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / brackets-edge-web-fonts / main.js View on Github external
function _handleGenerateInclude() {
            var editor = EditorManager.getFocusedEditor() || EditorManager.getCurrentFullEditor();
            var parser = _getParserForContext(editor);
            var fonts = parser.parseCurrentEditor(false);
            var fontFamilies = [], allFvds = [];
            var i, j, f;
            var includeString = "";
            
            for (i = 0; i < fonts.length; i++) {
                f = webfont.getFontBySlug(fonts[i]);
                if (f) {
                    allFvds = [];
                    for (j = 0; j < f.variations.length; j++) {
                        allFvds.push(f.variations[j].fvd);
                    }
                    fontFamilies.push({slug: f.slug, fvds: allFvds, subset: "all"});
                }
            }
            
            if (fontFamilies.length === 0) { // no EWF in this css file
                _showHowtoDialog();
            } else {
                includeString = webfont.createInclude(fontFamilies);
                var dlg = Dialogs.showModalDialogUsingTemplate(ewfIncludeDialogTemplate);
                $('.instance .ewf-include-string').html(_.escape(includeString)).focus().select();
            }
github adobe / brackets-edge-web-fonts / main.js View on Github external
slugs.forEach(function (slug) {
                        var font = webfont.getFontBySlug(slug),
                            script;
                        if (!(scriptCache.hasOwnProperty(slug)) && window.navigator.onLine) {
                            script = webfont.createInclude([font]);
                            $(script).appendTo("head");
                            scriptCache[slug] = true;
                        }
                    });

webfont

Generator of fonts from svg icons, svg icons to svg font, svg font to ttf, ttf to eot, ttf to woff, ttf to woff2

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis