From 206234022b3709378949423cc5d90494384fab6d Mon Sep 17 00:00:00 2001 From: Ryan Prince Date: Wed, 24 Jul 2019 23:39:54 -0400 Subject: [PATCH] Add decorationStrokeWidth. --- examples/pdfs/textDecorations.pdf | Bin 8667 -> 10948 bytes examples/textDecorations.js | 13 +++++++++++-- src/StyleContextStack.js | 1 + src/TextDecorator.js | 12 +++++++++--- src/TextInlines.js | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/examples/pdfs/textDecorations.pdf b/examples/pdfs/textDecorations.pdf index 006f5670acd8c28102a28d4deebbe1e90ee9d2b3..b450c4a30c602cdfdced091a37dc58eba68db1d6 100644 GIT binary patch delta 9149 zcmai(XH-*B_vTfaAYG9n(g_MkAS868mq@RIKtQC0ssaL`M0y7yU@%HA(tC$cq>FT< z7wI4!LI;`f&U~5wJ8R8d_ru9^_rB-c^V|FRa5AmXZcr+En-B~V1f$ZZIFNla12N0W z?}_)kWt6ZVd%x`SaMBvBmpXXgW+k7X{S&y*=DZuV5ctsO-djC6;MyqUqAR}YV+o%4EzdncyPHiGJoCn{rYNmP3!vjVjh-)MEpg+Iv+Vq zO)WGVYZfnlR$mzVqPaS60gb#q!{N^Q49%LrMnzR-*|ACfMaXNt=F4%dLA8eLmslUa z^Ikof7soX+Tl=tCmGi2Bhm$~=LW;BRiOMj)(@Pv{GrZ{Nh;vhAJa+bKXVbPY)kvn! zZ`A{RoQh`scecTb^gJK;=-F~+{bq9--@*F##A85yY0B#7)QQllJCYpI2ZVN`x#p0E zn=Q5G<70hokbm#4q;@5nMXt3xNY=e#u}DL`5{dd3DLg0fqu-AX>*6nVhSz>qMVk9n zq}M+dokYvXaGj$?^$PW#7H7QXK+lbP2_bM^@bS{^Z=R`r33DYvnl)u7RP&R%ryRf6 zya45?u@1n2#OhclByc=s8{yI9CmRAEud3I+aF^QZdU`bV+jaZ9fCE*fN%O9g{P-)= z{@8Yj+YLw$#+OwRlr@=qy~*FIMf`r9{*LMFWnp@G=ng9uu7uzI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SJs9~r{`F{Wc{zZZS diff --git a/examples/textDecorations.js b/examples/textDecorations.js index d1593bbf3..5bdd8185b 100644 --- a/examples/textDecorations.js +++ b/examples/textDecorations.js @@ -11,7 +11,6 @@ var pdfmake = require('../js/index'); pdfmake.setFonts(fonts); var ct = []; -var lorem = 'Lorem ipsum dolor sit amet'; ct.push({ text: 'Higlighted text', fontSize: 18, background: 'yellow' }); ct.push(' '); @@ -31,7 +30,7 @@ ct.push({ { text: 'Wavy style', decoration: 'underline', decorationStyle: 'wavy' } ] }); -ct.push(' ') +ct.push(' '); ct.push({ columns: [ { text: 'Using colors', decoration: 'underline', decorationColor: 'blue' }, @@ -39,6 +38,16 @@ ct.push({ { text: 'Using colors', decoration: 'underline', decorationStyle: 'wavy', decorationColor: 'green' } ] }); +ct.push(' '); +ct.push({ + columns: [ + { text: 'Stroke width 3', decoration: 'underline', decorationColor: 'blue', decorationStrokeWidth: 3, decorationStyle: 'dashed' }, + { text: 'Stroke width 5', decoration: 'underline', decorationColor: 'red', decorationStrokeWidth: 5, decorationStyle: 'dotted' }, + { text: 'Stroke width 2', decoration: 'underline', decorationColor: 'purple', decorationStrokeWidth: 2, decorationStyle: 'wavy' }, + { text: 'Stroke width 2', decoration: 'underline', decorationColor: 'black', decorationStrokeWidth: 2, decorationStyle: 'double' }, + { text: 'Stroke width 2', decoration: 'lineThrough', decorationColor: 'grey', decorationStrokeWidth: 2 } + ] +}); diff --git a/src/StyleContextStack.js b/src/StyleContextStack.js index d5a7f6d15..8027772ab 100644 --- a/src/StyleContextStack.js +++ b/src/StyleContextStack.js @@ -92,6 +92,7 @@ class StyleContextStack { 'decoration', 'decorationStyle', 'decorationColor', + 'decorationStrokeWidth', 'background', 'lineHeight', 'characterSpacing', diff --git a/src/TextDecorator.js b/src/TextDecorator.js index f234216ad..f688f5c48 100644 --- a/src/TextDecorator.js +++ b/src/TextDecorator.js @@ -15,6 +15,9 @@ const groupDecorations = line => { } let color = inline.decorationColor || inline.color || 'black'; let style = inline.decorationStyle || 'solid'; + let strokeWidth = typeof inline.decorationStrokeWidth === 'number' + ? inline.decorationStrokeWidth + : null; for (let ii = 0, ll = decoration.length; ii < ll; ii++) { let decorationItem = decoration[ii]; if (!currentGroup || decorationItem !== currentGroup.decoration || @@ -25,6 +28,7 @@ const groupDecorations = line => { decoration: decorationItem, decorationColor: color, decorationStyle: style, + decorationStrokeWidth: strokeWidth, inlines: [inline] }; groups.push(currentGroup); @@ -91,7 +95,9 @@ class TextDecorator { let height = biggerInline.height; let descent = height - ascent; - let lw = 0.5 + Math.floor(Math.max(biggerInline.fontSize - 8, 0) / 2) * 0.12; + let lw = typeof group.decorationStrokeWidth === 'number' + ? group.decorationStrokeWidth + : 0.5 + Math.floor(Math.max(biggerInline.fontSize - 8, 0) / 2) * 0.12; switch (group.decoration) { case 'underline': @@ -109,7 +115,7 @@ class TextDecorator { this.pdfDocument.save(); if (group.decorationStyle === 'double') { - let gap = Math.max(0.5, lw * 2); + let gap = Math.max(1.75, lw * .85 ); this.pdfDocument.fillColor(group.decorationColor) .rect(x + firstInline.x, y - lw / 2, totalWidth, lw / 2).fill() .rect(x + firstInline.x, y + gap - lw / 2, totalWidth, lw / 2).fill(); @@ -136,7 +142,7 @@ class TextDecorator { let nbWaves = Math.ceil(totalWidth / (sh * 2)) + 1; let rwx = x + firstInline.x - 1; this.pdfDocument.rect(x + firstInline.x, y - sv, totalWidth, y + sv).clip(); - this.pdfDocument.lineWidth(0.24); + this.pdfDocument.lineWidth(lw); this.pdfDocument.moveTo(rwx, y); for (let i = 0; i < nbWaves; i++) { this.pdfDocument.bezierCurveTo(rwx + sh, y - sv, rwx + sh * 2, y - sv, rwx + sh * 3, y) diff --git a/src/TextInlines.js b/src/TextInlines.js index 2664645c6..a230884eb 100644 --- a/src/TextInlines.js +++ b/src/TextInlines.js @@ -118,6 +118,7 @@ class TextInlines { item.decoration = StyleContextStack.getStyleProperty(item, styleContextStack, 'decoration', null); item.decorationColor = StyleContextStack.getStyleProperty(item, styleContextStack, 'decorationColor', null); item.decorationStyle = StyleContextStack.getStyleProperty(item, styleContextStack, 'decorationStyle', null); + item.decorationStrokeWidth = StyleContextStack.getStyleProperty(item, styleContextStack, 'decorationStrokeWidth', null); item.background = StyleContextStack.getStyleProperty(item, styleContextStack, 'background', null); item.link = StyleContextStack.getStyleProperty(item, styleContextStack, 'link', null); item.linkToPage = StyleContextStack.getStyleProperty(item, styleContextStack, 'linkToPage', null);