webfontloader 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/README.md +10 -0
- data/lib/webfontloader.rb +1 -1
- data/package.json +1 -1
- data/src/core/fontwatcher.js +7 -2
- data/src/core/fontwatchrunner.js +2 -2
- data/webfontloader.gemspec +2 -2
- data/webfontloader.js +15 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74ca9435faf8a796517dc273b51610a27ae2aed8
|
4
|
+
data.tar.gz: aa38077c5b166cbfbc6e8be4eee1a543f26ffe2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eac947e55dbfc9294c7aaaccde2060a3237852d686076d2ffcc65b050ea1bafabdf79c6a37fbfb789edba79e5f5ce22b8c76f92707ba059562afabe1ba5ac7c
|
7
|
+
data.tar.gz: 7fdd6dd836bcc186fb4516e0e1331d124d6490a530f2811894808be3d9d1c0fda0703906d8858df4ae3a1f810de5ff0f8441e10468d038a3e171d2a7e95a4212
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -295,6 +295,16 @@ WebFontConfig = {
|
|
295
295
|
};
|
296
296
|
```
|
297
297
|
|
298
|
+
If you need to specify character subsets other than the default (e.g.: greek script in addition to latin), you must append the subset string to the requested family string after a colon. The subset string should follow the [Google documentation](https://developers.google.com/fonts/docs/getting_started#Subsets) (subset names separated by commas):
|
299
|
+
|
300
|
+
```javascript
|
301
|
+
WebFontConfig = {
|
302
|
+
google: {
|
303
|
+
families: ['Open Sans Condensed:300,700:latin,greek']
|
304
|
+
}
|
305
|
+
};
|
306
|
+
```
|
307
|
+
|
298
308
|
You can also supply the `text` parameter to perform character subsetting:
|
299
309
|
|
300
310
|
```javascript
|
data/lib/webfontloader.rb
CHANGED
data/package.json
CHANGED
data/src/core/fontwatcher.js
CHANGED
@@ -52,7 +52,8 @@ goog.scope(function () {
|
|
52
52
|
this.last_ = last;
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
var i, fontWatchRunners = [];
|
56
|
+
for (i = 0; i < fonts.length; i++) {
|
56
57
|
var font = fonts[i],
|
57
58
|
testString = testStrings[font.getName()];
|
58
59
|
|
@@ -92,7 +93,11 @@ goog.scope(function () {
|
|
92
93
|
testString
|
93
94
|
);
|
94
95
|
|
95
|
-
|
96
|
+
fontWatchRunners.push(fontWatchRunner);
|
97
|
+
}
|
98
|
+
|
99
|
+
for (i = 0; i < fontWatchRunners.length; i++) {
|
100
|
+
fontWatchRunners[i].start();
|
96
101
|
}
|
97
102
|
};
|
98
103
|
|
data/src/core/fontwatchrunner.js
CHANGED
@@ -101,13 +101,13 @@ goog.scope(function () {
|
|
101
101
|
this.fontRulerA_.insert();
|
102
102
|
this.fontRulerB_.insert();
|
103
103
|
this.fontRulerC_.insert();
|
104
|
+
};
|
104
105
|
|
106
|
+
FontWatchRunner.prototype.start = function() {
|
105
107
|
this.lastResortWidths_[FontWatchRunner.LastResortFonts.SERIF] = this.fontRulerA_.getWidth();
|
106
108
|
this.lastResortWidths_[FontWatchRunner.LastResortFonts.SANS_SERIF] = this.fontRulerB_.getWidth();
|
107
109
|
this.lastResortWidths_[FontWatchRunner.LastResortFonts.MONOSPACE] = this.fontRulerC_.getWidth();
|
108
|
-
};
|
109
110
|
|
110
|
-
FontWatchRunner.prototype.start = function() {
|
111
111
|
this.started_ = goog.now();
|
112
112
|
|
113
113
|
this.fontRulerA_.setFont(new Font(this.font_.getName() + ',' + FontWatchRunner.LastResortFonts.SERIF, this.font_.getVariation()));
|
data/webfontloader.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'webfontloader'
|
16
|
-
s.version = '1.6.
|
17
|
-
s.date = '2015-
|
16
|
+
s.version = '1.6.4'
|
17
|
+
s.date = '2015-07-09'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
data/webfontloader.js
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
/* Web Font Loader v1.6.
|
2
|
-
(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function m(a,b,c){m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return m.apply(null,arguments)}var
|
1
|
+
/* Web Font Loader v1.6.4 - (c) Adobe Systems, Google. License: Apache 2.0 */
|
2
|
+
(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function m(a,b,c){m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return m.apply(null,arguments)}var p=Date.now||function(){return+new Date};function r(a,b){this.C=a;this.q=b||a;this.D=this.q.document}r.prototype.createElement=function(a,b,c){a=this.D.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.D.createTextNode(c));return a};function s(a,b,c){a=a.D.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}
|
3
3
|
function t(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),f=0;f<b.length;f+=1){for(var e=!1,g=0;g<d.length;g+=1)if(b[f]===d[g]){e=!0;break}e||d.push(b[f])}b=[];for(f=0;f<d.length;f+=1){e=!1;for(g=0;g<c.length;g+=1)if(d[f]===c[g]){e=!0;break}e||b.push(d[f])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function u(a,b){for(var c=a.className.split(/\s+/),d=0,f=c.length;d<f;d++)if(c[d]==b)return!0;return!1}
|
4
4
|
function v(a){if("string"===typeof a.ca)return a.ca;var b=a.q.location.protocol;"about:"==b&&(b=a.C.location.protocol);return"https:"==b?"https:":"http:"}function w(a,b){var c=a.createElement("link",{rel:"stylesheet",href:b,media:"all"}),d=!1;c.onload=function(){d||(d=!0)};c.onerror=function(){d||(d=!0)};s(a,"head",c)}
|
5
|
-
function x(a,b,c,d){var f=a.D.getElementsByTagName("head")[0];if(f){var e=a.createElement("script",{src:b}),g=!1;e.onload=e.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),e.onload=e.onreadystatechange=null,"HEAD"==e.parentNode.tagName&&f.removeChild(e))};f.appendChild(e);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return e}return null};function
|
6
|
-
function
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
function
|
11
|
-
|
12
|
-
function ja(a,b,c,d,f){var e=0==--a.T;(a.O||a.P)&&setTimeout(function(){var a=f||null,l=d||null||{};if(0===c.length&&e)
|
13
|
-
function ia(a,b,c){var d=[],f=c.timeout;ea(b);var d=ga(a.t,c,a.a),e=new
|
14
|
-
var
|
15
|
-
|
16
|
-
c=c?c.split(","):e,0<c.length&&(c=
|
17
|
-
|
5
|
+
function x(a,b,c,d){var f=a.D.getElementsByTagName("head")[0];if(f){var e=a.createElement("script",{src:b}),g=!1;e.onload=e.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),e.onload=e.onreadystatechange=null,"HEAD"==e.parentNode.tagName&&f.removeChild(e))};f.appendChild(e);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return e}return null};function z(a){this.ba=a||"-"}z.prototype.d=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.ba)};function A(a,b){this.U=a;this.M=4;this.G="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.G=c[1],this.M=parseInt(c[2],10))}A.prototype.getName=function(){return this.U};function B(a){return a.G+a.M}function ca(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function da(a,b){this.a=a;this.j=a.q.document.documentElement;this.I=b;this.f="wf";this.e=new z("-");this.Y=!1!==b.events;this.v=!1!==b.classes}function ea(a){a.v&&t(a.j,[a.e.d(a.f,"loading")]);C(a,"loading")}function D(a){if(a.v){var b=u(a.j,a.e.d(a.f,"active")),c=[],d=[a.e.d(a.f,"loading")];b||c.push(a.e.d(a.f,"inactive"));t(a.j,c,d)}C(a,"inactive")}function C(a,b,c){if(a.Y&&a.I[b])if(c)a.I[b](c.getName(),B(c));else a.I[b]()};function fa(){this.u={}}function ga(a,b,c){var d=[],f;for(f in b)if(b.hasOwnProperty(f)){var e=a.u[f];e&&d.push(e(b[f],c))}return d};function E(a,b){this.a=a;this.A=b;this.g=this.a.createElement("span",{"aria-hidden":"true"},this.A)}function G(a){s(a.a,"body",a.g)}
|
6
|
+
function H(a){var b;b=[];for(var c=a.U.split(/,\s*/),d=0;d<c.length;d++){var f=c[d].replace(/['"]/g,"");-1==f.indexOf(" ")?b.push(f):b.push("'"+f+"'")}b=b.join(",");c="normal";"o"===a.G?c="oblique":"i"===a.G&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+b+";"+("font-style:"+c+";font-weight:"+(a.M+"00")+";")}
|
7
|
+
E.prototype.remove=function(){var a=this.g;a.parentNode&&a.parentNode.removeChild(a)};function I(a,b,c,d,f,e,g){this.N=a;this.aa=b;this.a=c;this.h=d;this.A=g||"BESbswy";this.p={};this.L=f||3E3;this.S=e||null;this.w=this.o=this.m=null;this.m=new E(this.a,this.A);this.o=new E(this.a,this.A);this.w=new E(this.a,this.A);a=new A("serif",B(this.h));a=H(a);this.m.g.style.cssText=a;a=new A("sans-serif",B(this.h));a=H(a);this.o.g.style.cssText=a;a=new A("monospace",B(this.h));a=H(a);this.w.g.style.cssText=a;G(this.m);G(this.o);G(this.w)}var J={ga:"serif",fa:"sans-serif",ea:"monospace"},K=null;
|
8
|
+
function L(){if(null===K){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);K=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return K}
|
9
|
+
I.prototype.start=function(){this.p.serif=this.m.g.offsetWidth;this.p["sans-serif"]=this.o.g.offsetWidth;this.p.monospace=this.w.g.offsetWidth;this.da=p();var a=new A(this.h.getName()+",serif",B(this.h)),a=H(a);this.m.g.style.cssText=a;a=new A(this.h.getName()+",sans-serif",B(this.h));a=H(a);this.o.g.style.cssText=a;M(this)};function N(a,b,c){for(var d in J)if(J.hasOwnProperty(d)&&b===a.p[J[d]]&&c===a.p[J[d]])return!0;return!1}
|
10
|
+
function M(a){var b=a.m.g.offsetWidth,c=a.o.g.offsetWidth,d;(d=b===a.p.serif&&c===a.p["sans-serif"])||(d=L()&&N(a,b,c));d?p()-a.da>=a.L?L()&&N(a,b,c)&&(null===a.S||a.S.hasOwnProperty(a.h.getName()))?O(a,a.N):O(a,a.aa):ha(a):O(a,a.N)}function ha(a){setTimeout(m(function(){M(this)},a),50)}function O(a,b){a.m.remove();a.o.remove();a.w.remove();b(a.h)};function P(a,b,c){this.a=a;this.s=b;this.J=0;this.W=this.R=!1;this.L=c}P.prototype.Z=function(a){var b=this.s;b.v&&t(b.j,[b.e.d(b.f,a.getName(),B(a).toString(),"active")],[b.e.d(b.f,a.getName(),B(a).toString(),"loading"),b.e.d(b.f,a.getName(),B(a).toString(),"inactive")]);C(b,"fontactive",a);this.W=!0;Q(this)};
|
11
|
+
P.prototype.$=function(a){var b=this.s;if(b.v){var c=u(b.j,b.e.d(b.f,a.getName(),B(a).toString(),"active")),d=[],f=[b.e.d(b.f,a.getName(),B(a).toString(),"loading")];c||d.push(b.e.d(b.f,a.getName(),B(a).toString(),"inactive"));t(b.j,d,f)}C(b,"fontinactive",a);Q(this)};function Q(a){0==--a.J&&a.R&&(a.W?(a=a.s,a.v&&t(a.j,[a.e.d(a.f,"active")],[a.e.d(a.f,"loading"),a.e.d(a.f,"inactive")]),C(a,"active")):D(a.s))};function R(a){this.C=a;this.t=new fa;this.T=0;this.O=this.P=!0}R.prototype.load=function(a){this.a=new r(this.C,a.context||this.C);this.P=!1!==a.events;this.O=!1!==a.classes;ia(this,new da(this.a,a),a)};
|
12
|
+
function ja(a,b,c,d,f){var e=0==--a.T;(a.O||a.P)&&setTimeout(function(){var a=f||null,l=d||null||{};if(0===c.length&&e)D(b.s);else{b.J+=c.length;e&&(b.R=e);var h,k=[];for(h=0;h<c.length;h++){var n=c[h],y=l[n.getName()],q=b.s,F=n;q.v&&t(q.j,[q.e.d(q.f,F.getName(),B(F).toString(),"loading")]);C(q,"fontloading",F);q=null;q=new I(m(b.Z,b),m(b.$,b),b.a,n,b.L,a,y);k.push(q)}for(h=0;h<k.length;h++)k[h].start()}},0)}
|
13
|
+
function ia(a,b,c){var d=[],f=c.timeout;ea(b);var d=ga(a.t,c,a.a),e=new P(a.a,b,f);a.T=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,c,d){ja(a,e,b,c,d)})};function S(a,b,c){this.H=a?a:b+ka;this.k=[];this.K=[];this.X=c||""}var ka="//fonts.googleapis.com/css";S.prototype.d=function(){if(0==this.k.length)throw Error("No fonts to load!");if(-1!=this.H.indexOf("kit="))return this.H;for(var a=this.k.length,b=[],c=0;c<a;c++)b.push(this.k[c].replace(/ /g,"+"));a=this.H+"?family="+b.join("%7C");0<this.K.length&&(a+="&subset="+this.K.join(","));0<this.X.length&&(a+="&text="+encodeURIComponent(this.X));return a};function T(a){this.k=a;this.V=[];this.F={}}
|
14
|
+
var U={latin:"BESbswy",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},la={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ma={i:"i",italic:"i",n:"n",normal:"n"},na=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
|
15
|
+
T.prototype.parse=function(){for(var a=this.k.length,b=0;b<a;b++){var c=this.k[b].split(":"),d=c[0].replace(/\+/g," "),f=["n4"];if(2<=c.length){var e;var g=c[1];e=[];if(g)for(var g=g.split(","),l=g.length,h=0;h<l;h++){var k;k=g[h];if(k.match(/^[\w-]+$/))if(k=na.exec(k.toLowerCase()),null==k)k="";else{var n;n=k[1];if(null==n||""==n)n="4";else{var y=la[n];n=y?y:isNaN(n)?"4":n.substr(0,1)}k=k[2];k=[null==k||""==k?"n":ma[k],n].join("")}else k="";k&&e.push(k)}0<e.length&&(f=e);3==c.length&&(c=c[2],e=[],
|
16
|
+
c=c?c.split(","):e,0<c.length&&(c=U[c[0]])&&(this.F[d]=c))}this.F[d]||(c=U[d])&&(this.F[d]=c);for(c=0;c<f.length;c+=1)this.V.push(new A(d,f[c]))}};function V(a,b){this.a=a;this.c=b}var oa={Arimo:!0,Cousine:!0,Tinos:!0};V.prototype.load=function(a){for(var b=this.a,c=new S(this.c.api,v(b),this.c.text),d=this.c.families,f=d.length,e=0;e<f;e++){var g=d[e].split(":");3==g.length&&c.K.push(g.pop());var l="";2==g.length&&""!=g[1]&&(l=":");c.k.push(g.join(l))}d=new T(d);d.parse();w(b,c.d());a(d.V,d.F,oa)};function W(a,b){this.a=a;this.c=b;this.Q=[]}W.prototype.B=function(a){var b=this.a;return v(this.a)+(this.c.api||"//f.fontdeck.com/s/css/js/")+(b.q.location.hostname||b.C.location.hostname)+"/"+a+".js"};
|
17
|
+
W.prototype.load=function(a){var b=this.c.id,c=this.a.q,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,l=c.fonts.length;g<l;++g){var h=c.fonts[g];d.Q.push(new A(h.name,ca("font-weight:"+h.weight+";font-style:"+h.style)))}a(d.Q)},x(this.a,this.B(b),function(b){b&&a([])})):a([])};function X(a,b){this.a=a;this.c=b}X.prototype.B=function(a){return(this.c.api||"https://use.typekit.net")+"/"+a+".js"};X.prototype.load=function(a){var b=this.c.id,c=this.a.q;b?x(this.a,this.B(b),function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var f=[],e=0;e<b.length;e+=2)for(var g=b[e],l=b[e+1],h=0;h<l.length;h++)f.push(new A(g,l[h]));try{c.Typekit.load({events:!1,classes:!1})}catch(k){}a(f)}},2E3):a([])};function Y(a,b){this.a=a;this.c=b}Y.prototype.B=function(a,b){var c=v(this.a),d=(this.c.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};Y.prototype.load=function(a){var b=this.c.projectId,c=this.c.version;if(b){var d=this.a.q;x(this.a,this.B(b,c),function(c){if(c)a([]);else if(d["__mti_fntLst"+b]){c=d["__mti_fntLst"+b]();var e=[];if(c)for(var g=0;g<c.length;g++)e.push(new A(c[g].fontfamily));a(e)}else a([])}).id="__MonotypeAPIScript__"+b}else a([])};function pa(a,b){this.a=a;this.c=b}pa.prototype.load=function(a){var b,c,d=this.c.urls||[],f=this.c.families||[],e=this.c.testStrings||{};b=0;for(c=d.length;b<c;b++)w(this.a,d[b]);d=[];b=0;for(c=f.length;b<c;b++){var g=f[b].split(":");if(g[1])for(var l=g[1].split(","),h=0;h<l.length;h+=1)d.push(new A(g[0],l[h]));else d.push(new A(g[0]))}a(d,e)};var Z=new R(window);Z.t.u.custom=function(a,b){return new pa(b,a)};Z.t.u.fontdeck=function(a,b){return new W(b,a)};Z.t.u.monotype=function(a,b){return new Y(b,a)};Z.t.u.typekit=function(a,b){return new X(b,a)};Z.t.u.google=function(a,b){return new V(b,a)};var $={load:m(Z.load,Z)};"function"===typeof define&&define.amd?define(function(){return $}):"undefined"!==typeof module&&module.exports?module.exports=$:(window.WebFont=$,window.WebFontConfig&&Z.load(window.WebFontConfig));}());
|
18
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webfontloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Carver
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|