fabric 6.6.6 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +103 -78
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +103 -78
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +103 -78
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +103 -78
- package/dist/index.node.mjs.map +1 -1
- package/dist/package.json.min.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/parser/constants.d.ts +2 -0
- package/dist/src/parser/constants.d.ts.map +1 -1
- package/dist/src/parser/constants.min.mjs +1 -1
- package/dist/src/parser/constants.min.mjs.map +1 -1
- package/dist/src/parser/constants.mjs +11 -6
- package/dist/src/parser/constants.mjs.map +1 -1
- package/dist/src/parser/normalizeValue.d.ts.map +1 -1
- package/dist/src/parser/normalizeValue.min.mjs +1 -1
- package/dist/src/parser/normalizeValue.min.mjs.map +1 -1
- package/dist/src/parser/normalizeValue.mjs +2 -1
- package/dist/src/parser/normalizeValue.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.d.ts +14 -1
- package/dist/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist/src/shapes/Text/Text.min.mjs +1 -1
- package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.mjs +16 -8
- package/dist/src/shapes/Text/Text.mjs.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.d.ts.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.mjs +14 -5
- package/dist/src/shapes/Text/TextSVGExportMixin.mjs.map +1 -1
- package/dist/src/shapes/Text/constants.d.ts +3 -2
- package/dist/src/shapes/Text/constants.d.ts.map +1 -1
- package/dist/src/shapes/Text/constants.min.mjs +1 -1
- package/dist/src/shapes/Text/constants.min.mjs.map +1 -1
- package/dist/src/shapes/Text/constants.mjs +21 -17
- package/dist/src/shapes/Text/constants.mjs.map +1 -1
- package/dist/src/util/misc/objectEnlive.d.ts +1 -1
- package/dist/src/util/misc/textStyles.d.ts.map +1 -1
- package/dist/src/util/misc/textStyles.min.mjs +1 -1
- package/dist/src/util/misc/textStyles.min.mjs.map +1 -1
- package/dist/src/util/misc/textStyles.mjs +1 -1
- package/dist/src/util/misc/textStyles.mjs.map +1 -1
- package/dist-extensions/src/parser/constants.d.ts +2 -0
- package/dist-extensions/src/parser/constants.d.ts.map +1 -1
- package/dist-extensions/src/parser/normalizeValue.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/Text.d.ts +14 -1
- package/dist-extensions/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/TextSVGExportMixin.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/constants.d.ts +3 -2
- package/dist-extensions/src/shapes/Text/constants.d.ts.map +1 -1
- package/dist-extensions/src/util/misc/textStyles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/parser/applyViewboxTransform.spec.ts +396 -0
- package/src/parser/constants.spec.ts +35 -0
- package/src/parser/constants.ts +7 -16
- package/src/parser/normalizeValue.ts +2 -1
- package/src/shapes/Text/Text.ts +44 -11
- package/src/shapes/Text/TextSVGExportMixin.ts +16 -8
- package/src/shapes/Text/__snapshots__/Text.spec.ts.snap +4 -3
- package/src/shapes/Text/constants.ts +22 -15
- package/src/shapes/__snapshots__/Textbox.spec.ts.snap +2 -0
- package/src/util/misc/textStyles.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.7.0]
|
|
4
|
+
|
|
5
|
+
- feat(Text): Add support for text decoration tickness [#10643](https://github.com/fabricjs/fabric.js/pull/10643)
|
|
6
|
+
|
|
7
|
+
## [6.6.7]
|
|
8
|
+
|
|
9
|
+
- fix(): Fix regex to parse the viewbox attribute to be more strict [#10636](https://github.com/fabricjs/fabric.js/pull/10636)
|
|
10
|
+
|
|
3
11
|
## [6.6.6]
|
|
4
12
|
|
|
5
13
|
- fix(): Polygon controls util should invalidate cache [#10628](https://github.com/fabricjs/fabric.js/pull/10628)
|
package/dist/index.js
CHANGED
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
}
|
|
412
412
|
const cache = new Cache();
|
|
413
413
|
|
|
414
|
-
var version = "6.
|
|
414
|
+
var version = "6.7.0";
|
|
415
415
|
|
|
416
416
|
// use this syntax so babel plugin see this import here
|
|
417
417
|
const VERSION = version;
|
|
@@ -4837,8 +4837,73 @@
|
|
|
4837
4837
|
return new RegExp('^(' + arr.join('|') + ')\\b', 'i');
|
|
4838
4838
|
}
|
|
4839
4839
|
|
|
4840
|
-
|
|
4841
|
-
const
|
|
4840
|
+
const TEXT_DECORATION_THICKNESS = 'textDecorationThickness';
|
|
4841
|
+
const fontProperties = ['fontSize', 'fontWeight', 'fontFamily', 'fontStyle'];
|
|
4842
|
+
const textDecorationProperties = ['underline', 'overline', 'linethrough'];
|
|
4843
|
+
const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign'];
|
|
4844
|
+
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS];
|
|
4845
|
+
const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor', TEXT_DECORATION_THICKNESS];
|
|
4846
|
+
|
|
4847
|
+
// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
|
|
4848
|
+
// regexes, list of properties that are not suppose to change by instances, magic consts.
|
|
4849
|
+
// this will be a separated effort
|
|
4850
|
+
const textDefaultValues = {
|
|
4851
|
+
_reNewline: reNewline,
|
|
4852
|
+
_reSpacesAndTabs: /[ \t\r]/g,
|
|
4853
|
+
_reSpaceAndTab: /[ \t\r]/,
|
|
4854
|
+
_reWords: /\S+/g,
|
|
4855
|
+
fontSize: 40,
|
|
4856
|
+
fontWeight: 'normal',
|
|
4857
|
+
fontFamily: 'Times New Roman',
|
|
4858
|
+
underline: false,
|
|
4859
|
+
overline: false,
|
|
4860
|
+
linethrough: false,
|
|
4861
|
+
textAlign: LEFT,
|
|
4862
|
+
fontStyle: 'normal',
|
|
4863
|
+
lineHeight: 1.16,
|
|
4864
|
+
textBackgroundColor: '',
|
|
4865
|
+
stroke: null,
|
|
4866
|
+
shadow: null,
|
|
4867
|
+
path: undefined,
|
|
4868
|
+
pathStartOffset: 0,
|
|
4869
|
+
pathSide: LEFT,
|
|
4870
|
+
pathAlign: 'baseline',
|
|
4871
|
+
charSpacing: 0,
|
|
4872
|
+
deltaY: 0,
|
|
4873
|
+
direction: 'ltr',
|
|
4874
|
+
CACHE_FONT_SIZE: 400,
|
|
4875
|
+
MIN_TEXT_WIDTH: 2,
|
|
4876
|
+
// Text magic numbers
|
|
4877
|
+
superscript: {
|
|
4878
|
+
size: 0.6,
|
|
4879
|
+
// fontSize factor
|
|
4880
|
+
baseline: -0.35 // baseline-shift factor (upwards)
|
|
4881
|
+
},
|
|
4882
|
+
subscript: {
|
|
4883
|
+
size: 0.6,
|
|
4884
|
+
// fontSize factor
|
|
4885
|
+
baseline: 0.11 // baseline-shift factor (downwards)
|
|
4886
|
+
},
|
|
4887
|
+
_fontSizeFraction: 0.222,
|
|
4888
|
+
offsets: {
|
|
4889
|
+
underline: 0.1,
|
|
4890
|
+
linethrough: -0.28167,
|
|
4891
|
+
// added 1/30 to original number
|
|
4892
|
+
overline: -0.81333 // added 1/15 to original number
|
|
4893
|
+
},
|
|
4894
|
+
_fontSizeMult: 1.13,
|
|
4895
|
+
[TEXT_DECORATION_THICKNESS]: 66.667 // before implementation was 1/15
|
|
4896
|
+
};
|
|
4897
|
+
const JUSTIFY = 'justify';
|
|
4898
|
+
const JUSTIFY_LEFT = 'justify-left';
|
|
4899
|
+
const JUSTIFY_RIGHT = 'justify-right';
|
|
4900
|
+
const JUSTIFY_CENTER = 'justify-center';
|
|
4901
|
+
|
|
4902
|
+
var _templateObject$1, _templateObject2$1, _templateObject3$1;
|
|
4903
|
+
|
|
4904
|
+
// matches, e.g.: +14.56e-12, etc.
|
|
4905
|
+
const reNum = String.raw(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["[-+]?(?:d*.d+|d+.?)(?:[eE][-+]?d+)?"], ["[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?"])));
|
|
4906
|
+
const viewportSeparator = String.raw(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["(?:s*,?s+|s*,s*)"], ["(?:\\s*,?\\s+|\\s*,\\s*)"])));
|
|
4842
4907
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
4843
4908
|
const reFontDeclaration = new RegExp('(normal|italic)?\\s*(normal|small-caps)?\\s*' + '(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(' + reNum + '(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|' + reNum + '))?\\s+(.*)');
|
|
4844
4909
|
const svgValidTagNames = ['path', 'circle', 'polygon', 'polyline', 'ellipse', 'rect', 'line', 'image', 'text'],
|
|
@@ -4875,7 +4940,8 @@
|
|
|
4875
4940
|
'clip-path': 'clipPath',
|
|
4876
4941
|
'clip-rule': 'clipRule',
|
|
4877
4942
|
'vector-effect': 'strokeUniform',
|
|
4878
|
-
'image-rendering': 'imageSmoothing'
|
|
4943
|
+
'image-rendering': 'imageSmoothing',
|
|
4944
|
+
'text-decoration-thickness': TEXT_DECORATION_THICKNESS
|
|
4879
4945
|
},
|
|
4880
4946
|
fSize = 'font-size',
|
|
4881
4947
|
cPath = 'clip-path';
|
|
@@ -4884,8 +4950,8 @@
|
|
|
4884
4950
|
const svgValidParentsRegEx = getSvgRegex(svgValidParents);
|
|
4885
4951
|
|
|
4886
4952
|
// http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
|
|
4887
|
-
|
|
4888
|
-
const reViewBoxAttrValue = new RegExp(
|
|
4953
|
+
|
|
4954
|
+
const reViewBoxAttrValue = new RegExp(String.raw(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["^s*(", ")", "(", ")", "(", ")", "(", ")s*$"], ["^\\s*(", ")", "(", ")", "(", ")", "(", ")\\s*$"])), reNum, viewportSeparator, reNum, viewportSeparator, reNum, viewportSeparator, reNum));
|
|
4889
4955
|
|
|
4890
4956
|
const unitVectorX = new Point(1, 0);
|
|
4891
4957
|
const zero = new Point();
|
|
@@ -10365,7 +10431,7 @@
|
|
|
10365
10431
|
*/
|
|
10366
10432
|
const hasStyleChanged = function (prevStyle, thisStyle) {
|
|
10367
10433
|
let forTextSpans = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
10368
|
-
return prevStyle.fill !== thisStyle.fill || prevStyle.stroke !== thisStyle.stroke || prevStyle.strokeWidth !== thisStyle.strokeWidth || prevStyle.fontSize !== thisStyle.fontSize || prevStyle.fontFamily !== thisStyle.fontFamily || prevStyle.fontWeight !== thisStyle.fontWeight || prevStyle.fontStyle !== thisStyle.fontStyle || prevStyle.textBackgroundColor !== thisStyle.textBackgroundColor || prevStyle.deltaY !== thisStyle.deltaY || forTextSpans && (prevStyle.overline !== thisStyle.overline || prevStyle.underline !== thisStyle.underline || prevStyle.linethrough !== thisStyle.linethrough);
|
|
10434
|
+
return prevStyle.fill !== thisStyle.fill || prevStyle.stroke !== thisStyle.stroke || prevStyle.strokeWidth !== thisStyle.strokeWidth || prevStyle.fontSize !== thisStyle.fontSize || prevStyle.fontFamily !== thisStyle.fontFamily || prevStyle.fontWeight !== thisStyle.fontWeight || prevStyle.fontStyle !== thisStyle.fontStyle || prevStyle.textDecorationThickness !== thisStyle.textDecorationThickness || prevStyle.textBackgroundColor !== thisStyle.textBackgroundColor || prevStyle.deltaY !== thisStyle.deltaY || forTextSpans && (prevStyle.overline !== thisStyle.overline || prevStyle.underline !== thisStyle.underline || prevStyle.linethrough !== thisStyle.linethrough);
|
|
10369
10435
|
};
|
|
10370
10436
|
|
|
10371
10437
|
/**
|
|
@@ -10653,7 +10719,7 @@
|
|
|
10653
10719
|
}
|
|
10654
10720
|
} else if (attr === 'textAnchor' /* text-anchor */) {
|
|
10655
10721
|
ouputValue = value === 'start' ? LEFT : value === 'end' ? RIGHT : CENTER;
|
|
10656
|
-
} else if (attr === 'charSpacing') {
|
|
10722
|
+
} else if (attr === 'charSpacing' || attr === TEXT_DECORATION_THICKNESS) {
|
|
10657
10723
|
// parseUnit returns px and we convert it to em
|
|
10658
10724
|
parsed = parseUnit(value, fontSize) / fontSize * 1000;
|
|
10659
10725
|
} else if (attr === 'paintFirst') {
|
|
@@ -18407,64 +18473,6 @@
|
|
|
18407
18473
|
classRegistry.setClass(Polygon);
|
|
18408
18474
|
classRegistry.setSVGClass(Polygon);
|
|
18409
18475
|
|
|
18410
|
-
const fontProperties = ['fontSize', 'fontWeight', 'fontFamily', 'fontStyle'];
|
|
18411
|
-
const textDecorationProperties = ['underline', 'overline', 'linethrough'];
|
|
18412
|
-
const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign'];
|
|
18413
|
-
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction'];
|
|
18414
|
-
const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor'];
|
|
18415
|
-
|
|
18416
|
-
// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
|
|
18417
|
-
// regexes, list of properties that are not suppose to change by instances, magic consts.
|
|
18418
|
-
// this will be a separated effort
|
|
18419
|
-
const textDefaultValues = {
|
|
18420
|
-
_reNewline: reNewline,
|
|
18421
|
-
_reSpacesAndTabs: /[ \t\r]/g,
|
|
18422
|
-
_reSpaceAndTab: /[ \t\r]/,
|
|
18423
|
-
_reWords: /\S+/g,
|
|
18424
|
-
fontSize: 40,
|
|
18425
|
-
fontWeight: 'normal',
|
|
18426
|
-
fontFamily: 'Times New Roman',
|
|
18427
|
-
underline: false,
|
|
18428
|
-
overline: false,
|
|
18429
|
-
linethrough: false,
|
|
18430
|
-
textAlign: LEFT,
|
|
18431
|
-
fontStyle: 'normal',
|
|
18432
|
-
lineHeight: 1.16,
|
|
18433
|
-
superscript: {
|
|
18434
|
-
size: 0.6,
|
|
18435
|
-
// fontSize factor
|
|
18436
|
-
baseline: -0.35 // baseline-shift factor (upwards)
|
|
18437
|
-
},
|
|
18438
|
-
subscript: {
|
|
18439
|
-
size: 0.6,
|
|
18440
|
-
// fontSize factor
|
|
18441
|
-
baseline: 0.11 // baseline-shift factor (downwards)
|
|
18442
|
-
},
|
|
18443
|
-
textBackgroundColor: '',
|
|
18444
|
-
stroke: null,
|
|
18445
|
-
shadow: null,
|
|
18446
|
-
path: undefined,
|
|
18447
|
-
pathStartOffset: 0,
|
|
18448
|
-
pathSide: LEFT,
|
|
18449
|
-
pathAlign: 'baseline',
|
|
18450
|
-
_fontSizeFraction: 0.222,
|
|
18451
|
-
offsets: {
|
|
18452
|
-
underline: 0.1,
|
|
18453
|
-
linethrough: -0.315,
|
|
18454
|
-
overline: -0.88
|
|
18455
|
-
},
|
|
18456
|
-
_fontSizeMult: 1.13,
|
|
18457
|
-
charSpacing: 0,
|
|
18458
|
-
deltaY: 0,
|
|
18459
|
-
direction: 'ltr',
|
|
18460
|
-
CACHE_FONT_SIZE: 400,
|
|
18461
|
-
MIN_TEXT_WIDTH: 2
|
|
18462
|
-
};
|
|
18463
|
-
const JUSTIFY = 'justify';
|
|
18464
|
-
const JUSTIFY_LEFT = 'justify-left';
|
|
18465
|
-
const JUSTIFY_RIGHT = 'justify-right';
|
|
18466
|
-
const JUSTIFY_CENTER = 'justify-center';
|
|
18467
|
-
|
|
18468
18476
|
class StyledText extends FabricObject {
|
|
18469
18477
|
/**
|
|
18470
18478
|
* Returns true if object has no styling or no styling in a line
|
|
@@ -18779,7 +18787,7 @@
|
|
|
18779
18787
|
} = _ref;
|
|
18780
18788
|
const noShadow = true,
|
|
18781
18789
|
textDecoration = this.getSvgTextDecoration(this);
|
|
18782
|
-
return [textBgRects.join(''), '\t\t<text xml:space="preserve" ',
|
|
18790
|
+
return [textBgRects.join(''), '\t\t<text xml:space="preserve" ', "font-family=\"".concat(this.fontFamily.replace(dblQuoteRegex, "'"), "\" "), "font-size=\"".concat(this.fontSize, "\" "), this.fontStyle ? "font-style=\"".concat(this.fontStyle, "\" ") : '', this.fontWeight ? "font-weight=\"".concat(this.fontWeight, "\" ") : '', textDecoration ? "text-decoration=\"".concat(textDecoration, "\" ") : '', this.direction === 'rtl' ? "direction=\"".concat(this.direction, "\" ") : '', 'style="', this.getSvgStyles(noShadow), '"', this.addPaintOrder(), ' >', textSpans.join(''), '</text>\n'];
|
|
18783
18791
|
}
|
|
18784
18792
|
|
|
18785
18793
|
/**
|
|
@@ -18936,7 +18944,7 @@
|
|
|
18936
18944
|
* @return {String}
|
|
18937
18945
|
*/
|
|
18938
18946
|
getSvgStyles(skipShadow) {
|
|
18939
|
-
return "".concat(super.getSvgStyles(skipShadow), " white-space: pre;");
|
|
18947
|
+
return "".concat(super.getSvgStyles(skipShadow), " text-decoration-thickness: ").concat(toFixed(this.textDecorationThickness * this.getObjectScaling().y / 10, config.NUM_FRACTION_DIGITS), "%; white-space: pre;");
|
|
18940
18948
|
}
|
|
18941
18949
|
|
|
18942
18950
|
/**
|
|
@@ -18954,10 +18962,19 @@
|
|
|
18954
18962
|
fontSize,
|
|
18955
18963
|
fontStyle,
|
|
18956
18964
|
fontWeight,
|
|
18957
|
-
deltaY
|
|
18965
|
+
deltaY,
|
|
18966
|
+
textDecorationThickness,
|
|
18967
|
+
linethrough,
|
|
18968
|
+
overline,
|
|
18969
|
+
underline
|
|
18958
18970
|
} = style;
|
|
18959
|
-
const textDecoration = this.getSvgTextDecoration(
|
|
18960
|
-
|
|
18971
|
+
const textDecoration = this.getSvgTextDecoration({
|
|
18972
|
+
underline: underline !== null && underline !== void 0 ? underline : this.underline,
|
|
18973
|
+
overline: overline !== null && overline !== void 0 ? overline : this.overline,
|
|
18974
|
+
linethrough: linethrough !== null && linethrough !== void 0 ? linethrough : this.linethrough
|
|
18975
|
+
});
|
|
18976
|
+
const thickness = textDecorationThickness || this.textDecorationThickness;
|
|
18977
|
+
return [stroke ? colorPropToSVG(STROKE, stroke) : '', strokeWidth ? "stroke-width: ".concat(strokeWidth, "; ") : '', fontFamily ? "font-family: ".concat(!fontFamily.includes("'") && !fontFamily.includes('"') ? "'".concat(fontFamily, "'") : fontFamily, "; ") : '', fontSize ? "font-size: ".concat(fontSize, "px; ") : '', fontStyle ? "font-style: ".concat(fontStyle, "; ") : '', fontWeight ? "font-weight: ".concat(fontWeight, "; ") : '', textDecoration ? "text-decoration: ".concat(textDecoration, "; text-decoration-thickness: ").concat(toFixed(thickness * this.getObjectScaling().y / 10, config.NUM_FRACTION_DIGITS), "%; ") : '', fill ? colorPropToSVG(FILL, fill) : '', deltaY ? "baseline-shift: ".concat(-deltaY, "; ") : '', useWhiteSpace ? 'white-space: pre; ' : ''].join('');
|
|
18961
18978
|
}
|
|
18962
18979
|
|
|
18963
18980
|
/**
|
|
@@ -19974,6 +19991,7 @@
|
|
|
19974
19991
|
const leftOffset = this._getLeftOffset(),
|
|
19975
19992
|
path = this.path,
|
|
19976
19993
|
charSpacing = this._getWidthOfCharSpacing(),
|
|
19994
|
+
offsetAligner = type === 'linethrough' ? 0.5 : type === 'overline' ? 1 : 0,
|
|
19977
19995
|
offsetY = this.offsets[type];
|
|
19978
19996
|
for (let i = 0, len = this._textLines.length; i < len; i++) {
|
|
19979
19997
|
const heightOfLine = this.getHeightOfLine(i);
|
|
@@ -19988,8 +20006,10 @@
|
|
|
19988
20006
|
let boxWidth = 0;
|
|
19989
20007
|
let lastDecoration = this.getValueOfPropertyAt(i, 0, type);
|
|
19990
20008
|
let lastFill = this.getValueOfPropertyAt(i, 0, FILL);
|
|
19991
|
-
let
|
|
19992
|
-
let
|
|
20009
|
+
let lastTickness = this.getValueOfPropertyAt(i, 0, TEXT_DECORATION_THICKNESS);
|
|
20010
|
+
let currentDecoration = lastDecoration;
|
|
20011
|
+
let currentFill = lastFill;
|
|
20012
|
+
let currentTickness = lastTickness;
|
|
19993
20013
|
const top = topOffset + maxHeight * (1 - this._fontSizeFraction);
|
|
19994
20014
|
let size = this.getHeightOfChar(i, 0);
|
|
19995
20015
|
let dy = this.getValueOfPropertyAt(i, 0, 'deltaY');
|
|
@@ -19997,29 +20017,33 @@
|
|
|
19997
20017
|
const charBox = this.__charBounds[i][j];
|
|
19998
20018
|
currentDecoration = this.getValueOfPropertyAt(i, j, type);
|
|
19999
20019
|
currentFill = this.getValueOfPropertyAt(i, j, FILL);
|
|
20020
|
+
currentTickness = this.getValueOfPropertyAt(i, j, TEXT_DECORATION_THICKNESS);
|
|
20000
20021
|
const currentSize = this.getHeightOfChar(i, j);
|
|
20001
20022
|
const currentDy = this.getValueOfPropertyAt(i, j, 'deltaY');
|
|
20002
20023
|
if (path && currentDecoration && currentFill) {
|
|
20024
|
+
const finalTickness = this.fontSize * currentTickness / 1000;
|
|
20003
20025
|
ctx.save();
|
|
20004
20026
|
// bug? verify lastFill is a valid fill here.
|
|
20005
20027
|
ctx.fillStyle = lastFill;
|
|
20006
20028
|
ctx.translate(charBox.renderLeft, charBox.renderTop);
|
|
20007
20029
|
ctx.rotate(charBox.angle);
|
|
20008
|
-
ctx.fillRect(-charBox.kernedWidth / 2, offsetY * currentSize + currentDy, charBox.kernedWidth,
|
|
20030
|
+
ctx.fillRect(-charBox.kernedWidth / 2, offsetY * currentSize + currentDy - offsetAligner * finalTickness, charBox.kernedWidth, finalTickness);
|
|
20009
20031
|
ctx.restore();
|
|
20010
|
-
} else if ((currentDecoration !== lastDecoration || currentFill !== lastFill || currentSize !== size || currentDy !== dy) && boxWidth > 0) {
|
|
20032
|
+
} else if ((currentDecoration !== lastDecoration || currentFill !== lastFill || currentSize !== size || currentTickness !== lastTickness || currentDy !== dy) && boxWidth > 0) {
|
|
20033
|
+
const finalTickness = this.fontSize * lastTickness / 1000;
|
|
20011
20034
|
let drawStart = leftOffset + lineLeftOffset + boxStart;
|
|
20012
20035
|
if (this.direction === 'rtl') {
|
|
20013
20036
|
drawStart = this.width - drawStart - boxWidth;
|
|
20014
20037
|
}
|
|
20015
|
-
if (lastDecoration && lastFill) {
|
|
20038
|
+
if (lastDecoration && lastFill && lastTickness) {
|
|
20016
20039
|
// bug? verify lastFill is a valid fill here.
|
|
20017
20040
|
ctx.fillStyle = lastFill;
|
|
20018
|
-
ctx.fillRect(drawStart, top + offsetY * size + dy, boxWidth,
|
|
20041
|
+
ctx.fillRect(drawStart, top + offsetY * size + dy - offsetAligner * finalTickness, boxWidth, finalTickness);
|
|
20019
20042
|
}
|
|
20020
20043
|
boxStart = charBox.left;
|
|
20021
20044
|
boxWidth = charBox.width;
|
|
20022
20045
|
lastDecoration = currentDecoration;
|
|
20046
|
+
lastTickness = currentTickness;
|
|
20023
20047
|
lastFill = currentFill;
|
|
20024
20048
|
size = currentSize;
|
|
20025
20049
|
dy = currentDy;
|
|
@@ -20032,7 +20056,8 @@
|
|
|
20032
20056
|
drawStart = this.width - drawStart - boxWidth;
|
|
20033
20057
|
}
|
|
20034
20058
|
ctx.fillStyle = currentFill;
|
|
20035
|
-
|
|
20059
|
+
const finalTickness = this.fontSize * currentTickness / 1000;
|
|
20060
|
+
currentDecoration && currentFill && currentTickness && ctx.fillRect(drawStart, top + offsetY * size + dy - offsetAligner * finalTickness, boxWidth - charSpacing, finalTickness);
|
|
20036
20061
|
topOffset += heightOfLine;
|
|
20037
20062
|
}
|
|
20038
20063
|
// if there is text background color no
|