Skip to content

Commit

Permalink
Merge pull request #1100 from Flamenco/remove_hotfix
Browse files Browse the repository at this point in the history
Remove hotfixes and update documentation
  • Loading branch information
Flamenco authored Mar 16, 2017
2 parents 392ec79 + 19b0184 commit 8ae35f6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
27 changes: 13 additions & 14 deletions HOTFIX_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,30 @@ where the pdf.hotfix field is the name of the hotfix.
var pdf new jsPDF(...);
pdf.hotfix.fill_close = true;

#Active Hotfixes
# Active Hotfixes
There are currently no active hotfixes.

#Accepted Hotfixes
## scale_text

##fill_close
###Applies To
context2d plugin

### Affects
Filling paths
Drawing and Filling Text when a scale transformation is active.

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


##scale_text

###Applies To
## fill_close
### Applies To
context2d plugin

### Affects
Drawing and Filling Text when a scale transformation is active.
Filling paths

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

#Accepted Hotfixes
There a currently no accepted hotfixes.
25 changes: 13 additions & 12 deletions plugins/context2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,14 @@
this.path = origPath;
}

var scale;
if (this.pdf.hotfix && this.pdf.hotfix.scale_text) {
// We only use X axis as scale hint
// We only use X axis as scale hint
var scale = 1;
try {
scale = this._matrix_decompose(this._getTransform()).scale[0];
} catch (e) {
console.warn(e);
}
else {
scale = 1;
}

// In some cases the transform was very small (5.715760606202283e-17). Most likely a canvg rounding error.
if (scale < .01) {
this.pdf.text(text, x, this._getBaseline(y), null, degs);
Expand Down Expand Up @@ -354,14 +354,15 @@
this.path = origPath;
}

var scale;
if (this.pdf.hotfix && this.pdf.hotfix.scale_text) {
// We only use the X axis as scale hint

var scale = 1;
// We only use the X axis as scale hint
try {
scale = this._matrix_decompose(this._getTransform()).scale[0];
} catch (e) {
console.warn(e);
}
else {
scale = 1;
}

if (scale === 1) {
this.pdf.text(text, x, this._getBaseline(y), {
stroke: true
Expand Down

0 comments on commit 8ae35f6

Please sign in to comment.