Skip to content

Commit 8ae35f6

Browse files
authored
Merge pull request #1100 from Flamenco/remove_hotfix
Remove hotfixes and update documentation
2 parents 392ec79 + 19b0184 commit 8ae35f6

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

HOTFIX_README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,30 @@ where the pdf.hotfix field is the name of the hotfix.
1212
var pdf new jsPDF(...);
1313
pdf.hotfix.fill_close = true;
1414

15-
#Active Hotfixes
15+
# Active Hotfixes
16+
There are currently no active hotfixes.
17+
18+
#Accepted Hotfixes
19+
## scale_text
1620

17-
##fill_close
1821
###Applies To
1922
context2d plugin
2023

2124
### Affects
22-
Filling paths
25+
Drawing and Filling Text when a scale transformation is active.
2326

2427
### Description
25-
In certain cases, closing a fill would result in a path resolving to an incorrect point.
26-
The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround.
28+
jsPDF currently has no way to draw scaled text.
29+
This hotfix scales the current font size by the x-axis scale factor.
2730

28-
29-
##scale_text
30-
31-
###Applies To
31+
## fill_close
32+
### Applies To
3233
context2d plugin
3334

3435
### Affects
35-
Drawing and Filling Text when a scale transformation is active.
36+
Filling paths
3637

3738
### Description
38-
jsPDF currently has no way to draw scaled text.
39-
This hotfix scales the current font size by the x-axis scale factor.
39+
In certain cases, closing a fill would result in a path resolving to an incorrect point.
40+
The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround.
4041

41-
#Accepted Hotfixes
42-
There a currently no accepted hotfixes.

plugins/context2d.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@
299299
this.path = origPath;
300300
}
301301

302-
var scale;
303-
if (this.pdf.hotfix && this.pdf.hotfix.scale_text) {
304-
// We only use X axis as scale hint
302+
// We only use X axis as scale hint
303+
var scale = 1;
304+
try {
305305
scale = this._matrix_decompose(this._getTransform()).scale[0];
306+
} catch (e) {
307+
console.warn(e);
306308
}
307-
else {
308-
scale = 1;
309-
}
309+
310310
// In some cases the transform was very small (5.715760606202283e-17). Most likely a canvg rounding error.
311311
if (scale < .01) {
312312
this.pdf.text(text, x, this._getBaseline(y), null, degs);
@@ -354,14 +354,15 @@
354354
this.path = origPath;
355355
}
356356

357-
var scale;
358-
if (this.pdf.hotfix && this.pdf.hotfix.scale_text) {
359-
// We only use the X axis as scale hint
357+
358+
var scale = 1;
359+
// We only use the X axis as scale hint
360+
try {
360361
scale = this._matrix_decompose(this._getTransform()).scale[0];
362+
} catch (e) {
363+
console.warn(e);
361364
}
362-
else {
363-
scale = 1;
364-
}
365+
365366
if (scale === 1) {
366367
this.pdf.text(text, x, this._getBaseline(y), {
367368
stroke: true

0 commit comments

Comments
 (0)