mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-19 19:01:52 +00:00
parent
181cdec80c
commit
702126eb85
2 changed files with 11 additions and 2 deletions
|
|
@ -844,7 +844,8 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* return font declaration string for canvas context
|
||||
* @returns {String} font declaration formatted for canvas context.
|
||||
*/
|
||||
_getFontDeclaration: function() {
|
||||
return [
|
||||
|
|
@ -852,7 +853,7 @@
|
|||
(fabric.isLikelyNode ? this.fontWeight : this.fontStyle),
|
||||
(fabric.isLikelyNode ? this.fontStyle : this.fontWeight),
|
||||
this.fontSize + 'px',
|
||||
(fabric.isLikelyNode ? ('"' + this.fontFamily + '"') : this.fontFamily)
|
||||
'"' + this.fontFamily + '"'
|
||||
].join(' ');
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,14 @@
|
|||
equal(text.toString(), '#<fabric.Text (1): { "text": "x", "fontFamily": "Times New Roman" }>');
|
||||
});
|
||||
|
||||
test('_getFontDeclaration', function() {
|
||||
var text = createTextObject();
|
||||
ok(typeof text._getFontDeclaration == 'function', 'has a private method _getFontDeclaration');
|
||||
var fontDecl = text._getFontDeclaration();
|
||||
ok(typeof fontDecl == 'string', 'it returns a string');
|
||||
equal(fontDecl, 'normal 40px "Times New Roman"');
|
||||
});
|
||||
|
||||
test('toObject', function() {
|
||||
var text = createTextObject();
|
||||
ok(typeof text.toObject == 'function');
|
||||
|
|
|
|||
Loading…
Reference in a new issue