mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-11 07:13:09 +00:00
Refactor iText again
This commit is contained in:
parent
c9e819ea8e
commit
3e75f63c7b
1 changed files with 15 additions and 9 deletions
|
|
@ -1607,8 +1607,23 @@
|
|||
? styleDeclaration.stroke.toLive(ctx)
|
||||
: styleDeclaration.stroke;
|
||||
}
|
||||
|
||||
ctx.lineWidth = styleDeclaration.strokeWidth || this.strokeWidth;
|
||||
|
||||
this._applyFontStyles(styleDeclaration);
|
||||
|
||||
if (typeof styleDeclaration.shadow === 'string') {
|
||||
styleDeclaration.shadow = new fabric.Shadow(styleDeclaration.shadow);
|
||||
}
|
||||
|
||||
this._setShadow.call(styleDeclaration, ctx);
|
||||
|
||||
ctx.font = this._getFontDeclaration.call(styleDeclaration);
|
||||
|
||||
return ctx.measureText(_char).width;
|
||||
},
|
||||
|
||||
_applyFontStyles: function(styleDeclaration) {
|
||||
if (!styleDeclaration.fontFamily) {
|
||||
styleDeclaration.fontFamily = this.fontFamily;
|
||||
}
|
||||
|
|
@ -1621,15 +1636,6 @@
|
|||
if (!styleDeclaration.fontStyle) {
|
||||
styleDeclaration.fontStyle = this.fontStyle;
|
||||
}
|
||||
if (typeof styleDeclaration.shadow === 'string') {
|
||||
styleDeclaration.shadow = new fabric.Shadow(styleDeclaration.shadow);
|
||||
}
|
||||
|
||||
this._setShadow.call(styleDeclaration, ctx);
|
||||
|
||||
ctx.font = this._getFontDeclaration.call(styleDeclaration);
|
||||
|
||||
return ctx.measureText(_char).width;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue