Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
0.1.7 dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Oct 27, 2015
1 parent 7fdb9b8 commit eff6ab7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "fontfaceonload",
"version": "0.1.6",
"main": ["dist/fontfaceonload.js"],
"ignore": [
"**/.*"
Expand Down
28 changes: 18 additions & 10 deletions dist/fontfaceonload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! fontfaceonload - v0.1.6 - 2015-03-13
/*! fontfaceonload - v0.1.7 - 2015-10-26
* https://github.com/zachleat/fontfaceonload
* Copyright (c) 2015 Zach Leatherman (@zachleat)
* MIT License */
Expand All @@ -10,12 +10,6 @@
SANS_SERIF_FONTS = 'sans-serif',
SERIF_FONTS = 'serif',

// lighter and bolder not supported
weightLookup = {
normal: '400',
bold: '700'
},

defaultOptions = {
tolerance: 2, // px
delay: 100,
Expand Down Expand Up @@ -74,7 +68,7 @@
parent = that.parent,
appended = that.appended,
dimensions,
options = this.options,
options = that.options,
ref = options.reference;

function getStyle( family ) {
Expand Down Expand Up @@ -143,11 +137,25 @@
})();
}; // end load()

FontFaceOnloadInstance.prototype.cleanFamilyName = function( family ) {
return family.replace( /[\'\"]/g, '' ).toLowerCase();
};

FontFaceOnloadInstance.prototype.cleanWeight = function( weight ) {
// lighter and bolder not supported
var weightLookup = {
normal: '400',
bold: '700'
};

return '' + (weightLookup[ weight ] || weight);
};

FontFaceOnloadInstance.prototype.checkFontFaces = function( timeout ) {
var _t = this;
doc.fonts.forEach(function( font ) {
if( font.family.toLowerCase() === _t.fontFamily.toLowerCase() &&
( weightLookup[ font.weight ] || font.weight ) === ''+_t.options.weight &&
if( _t.cleanFamilyName( font.family ) === _t.cleanFamilyName( _t.fontFamily ) &&
_t.cleanWeight( font.weight ) === _t.cleanWeight( _t.options.weight ) &&
font.style === _t.options.style ) {
font.load().then(function() {
_t.options.success();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fontfaceonload",
"version": "0.1.6",
"version": "0.1.7",
"description": "A simple utility to execute a callback when a webfont loads.",
"keywords": [
"grunt"
Expand Down
3 changes: 2 additions & 1 deletion src/fontfaceonload.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
parent = that.parent,
appended = that.appended,
dimensions,
options = this.options,
options = that.options,
ref = options.reference;

function getStyle( family ) {
Expand Down Expand Up @@ -135,6 +135,7 @@
FontFaceOnloadInstance.prototype.cleanFamilyName = function( family ) {
return family.replace( /[\'\"]/g, '' ).toLowerCase();
};

FontFaceOnloadInstance.prototype.cleanWeight = function( weight ) {
// lighter and bolder not supported
var weightLookup = {
Expand Down

0 comments on commit eff6ab7

Please sign in to comment.