Skip to content

Commit

Permalink
If font families are passed into load, then use them rather than the …
Browse files Browse the repository at this point in the history
…API response.
  • Loading branch information
ahume committed Jan 4, 2011
1 parent 2ee662a commit def62bf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/fontdeck/fontdeck_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ webfont.FontdeckScript.prototype.getScriptSrc = function(projectId) {

webfont.FontdeckScript.prototype.supportUserAgent = function(userAgent, support) {
var projectId = this.configuration_['id'];
var families = this.configuration_['families'] || null;
var self = this;

if (projectId) {
Expand All @@ -32,8 +33,12 @@ webfont.FontdeckScript.prototype.supportUserAgent = function(userAgent, support)
// and a list of supported fonts.
this.global_[webfont.FontdeckScript.HOOK][projectId] = function(data) {
self.domHelper_.insertInto('head', self.domHelper_.createCssLink(data['css']));
for (var i = 0, j = data['provides'].length; i < j; ++i) {
self.fontFamilies_.push(data['provides'][i].name);
if (families === null) {
for (var i = 0, j = data['provides'].length; i < j; ++i) {
self.fontFamilies_.push(data['provides'][i].name);
}
} else {
self.fontFamilies_ = families;
}
support(true);
};
Expand Down

0 comments on commit def62bf

Please sign in to comment.