src/core/font.js in webfontloader-1.5.6 vs src/core/font.js in webfontloader-1.5.7

- old
+ new

@@ -40,10 +40,20 @@ Font.prototype.getCssName = function () { return this.quote_(this.name_); }; /** + * Returns a CSS string representation of the font that + * can be used as the CSS font property shorthand. + * + * @return {string} + */ + Font.prototype.toCssString = function () { + return this.getCssStyle() + ' ' + this.getCssWeight() + ' 300px ' + this.getCssName(); + }; + + /** * @private * @param {string} name * @return {string} */ Font.prototype.quote_ = function (name) { @@ -69,19 +79,32 @@ /** * @return {string} */ Font.prototype.getCssVariation = function () { - var style = 'normal', - weight = this.weight_ + '00'; + return 'font-style:' + this.getCssStyle() + ';font-weight:' + this.getCssWeight() + ';'; + }; + /** + * @return {string} + */ + Font.prototype.getCssWeight = function () { + return this.weight_ + '00'; + }; + + /** + * @return {string} + */ + Font.prototype.getCssStyle = function () { + var style = 'normal'; + if (this.style_ === 'o') { style = 'oblique'; } else if (this.style_ === 'i') { style = 'italic'; } - return 'font-style:' + style + ';font-weight:' + weight + ';'; + return style; }; /** * Parses a CSS font declaration and returns a font * variation description.