How to use the webfont.getWebsafeFonts 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
} else { // not in the text
                        query = "";
                    }
                } else if (modeSupport.isFontNameToken(token)) { // is not wrapped in quotes
                    query = token.string.substring(0, cursor.ch - token.start);
                } else { // after a ":", a space, or a ","
                    query = "";
                }

                // candidate hints are lower case, so the query should be too
                lowerCaseQuery = query.toLocaleLowerCase();
                
                var candidates = parser.parseCurrentEditor(true);

                candidates = candidates.concat(lastTwentyFonts);
                candidates = candidates.concat(webfont.getWebsafeFonts());
                candidates = webfont.lowerSortUniqStringArray(candidates);
                candidates = webfont.filterAndSortArray(query, candidates);
                candidates = candidates.map(function (hint) {
                    var index       = hint.indexOf(lowerCaseQuery),
                        $hintObj    = $('<span>'),
                        slugs       = webfont.searchBySlug(hint);

                    // load the matching font scripts individually for cachability
                    slugs.forEach(function (slug) {
                        var font = webfont.getFontBySlug(slug),
                            script;
                        if (!(scriptCache.hasOwnProperty(slug)) &amp;&amp; window.navigator.onLine) {
                            script = webfont.createInclude([font]);
                            $(script).appendTo("head");
                            scriptCache[slug] = true;
                        }</span>

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