This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This function load font from web, stores it in localStorage and reuses on next page loads | |
| * Different to everything I found on the internet due to following facts | |
| * 1. Checks if the font is installed in the system and spend no time if it is | |
| * 2. Loads actual WOFF or WOFF2 fonts (if supported) and not bit base64 encoded version - so it faster | |
| * 3. Uses fetch API and FontFace API if available - it's cool! | |
| * 4. Return promises and uses jQuery for cases where native promises probably not available | |
| * | |
| * @param fontName (Field for font-face) | |
| * @param fontUrl (full URL but without .woff nor .woff2 extensions - format will be selected automatically) |
NewerOlder