Mercurial > gemma
changeset 3791:6081743c0d98 yworks-svg2pdf
client: merge
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Wed, 03 Jul 2019 16:54:17 +0200 |
parents | c66cdde873b5 (current diff) 60977e18e227 (diff) |
children | 3878bc0c8e58 |
files | |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue Wed Jul 03 16:50:28 2019 +0200 +++ b/client/src/components/Pdftool.vue Wed Jul 03 16:54:17 2019 +0200 @@ -829,13 +829,6 @@ textOptions ); } - }, - getTextHeight(numberOfLines) { - return ( - numberOfLines * - ((this.pdf.doc.getFontSize() * 25.4) / parseInt(this.form.resolution)) * - 1.15 // see https://github.com/yWorks/jsPDF/blob/master/jspdf.js#L207 - ); } }, mounted() {
--- a/client/src/lib/mixins.js Wed Jul 03 16:50:28 2019 +0200 +++ b/client/src/lib/mixins.js Wed Jul 03 16:54:17 2019 +0200 @@ -153,7 +153,16 @@ this.addRoundedBox(x, y, width, height, color, rounding, brcolor); }, getTextHeight(numberOfLines) { - return numberOfLines * ((this.pdf.doc.getFontSize() * 25.4) / 80) * 1.15; // see https://github.com/yWorks/jsPDF/blob/master/jspdf.js#L207 + // Return estimated height in mm. + + // FontSize is given in desktop publishing points defined as 1/72 inch. + // aka 25.4 / 72 mm + let fontSize = this.pdf.doc.getFontSize(); + let lineHeightFactor = 1.15; // default from jspdf-yworks 2.0.2 + if (typeof this.pdf.doc.getLineHeightFactor !== "undefined") { + lineHeightFactor = this.pdf.doc.getLineHeightFactor(); + } + return numberOfLines * fontSize * (25.4 / 72) * lineHeightFactor; }, // title for diagram addDiagramTitle(position, offset, size, color, text) {