Skip to content

Commit

Permalink
Version 1.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
av01d committed Sep 28, 2021
1 parent 5e12ebb commit 52c82db
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.4.5] - 2021-09-28
### Fixed
- Firefox did not load custom fonts properly.

## [1.4.4] - 2021-08-06
### Changed
- If `googleFonts` contains a non existing font, silently ignore the font.

## [1.4.3] - 2021-06-09
Expand Down
14 changes: 9 additions & 5 deletions dist/jquery.fontpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Made by Arjan Haverkamp, https://www.webgear.nl
* Copyright 2020-2021 Arjan Haverkamp
* MIT Licensed
* @version 1.4.4 - 2021-08-06
* @version 1.4.5 - 2021-09-28
* @url https://github.com/av01d/fontpicker-jquery-plugin
*/

Expand Down Expand Up @@ -5384,15 +5384,19 @@

switch(type) {
case 'google':
var url = 'https://fonts.googleapis.com/css?family=' + font.replace(/ /g,'+') + ':' + this.options.googleFonts[font].variants + '&display=swap';
this.options.debug && console.log('Loading Google font ' + font + ' from ' + url);
var url = 'https://fonts.googleapis.com/css?family=' + font.replace(/ /g,'+') + ':' + this.options.googleFonts[font].variants + '&display=swap';
$('head').append($('<link>', {href:url, rel:'stylesheet', type:'text/css'}));
break;

case 'local':
var hasFontAPI = 'fonts' in document && 'check' in document.fonts;
if (!hasFontAPI || !document.fonts.check('11pt ' + font)) {
this.options.debug && console.log('Loading local font ' + font);
this.options.debug && console.log('Loading local font ' + font);
if ('FontFace' in window) {
new FontFace(font, "url('" + this.options.localFontsUrl + font + ".woff')").load().then(function(font) {
document.fonts.add(font);
});
}
else {
$('head').append("<style> @font-face { font-family:'" + font + "'; src:local('" + font + "'), url('" + this.options.localFontsUrl + font + ".woff') format('woff'); } </style>");
}
break;
Expand Down
Loading

0 comments on commit 52c82db

Please sign in to comment.