From a3af02a2a88ca9cb411c6a2dcc58c6465ba0a45c Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Dec 2023 15:20:55 +0100 Subject: [PATCH 1/5] adds test case with line-breaks in list items reproduces #1486 --- ...xt-list-with-line-breaks-in-value-1-snap.png | Bin 0 -> 13919 bytes tests/visual/text.spec.js | 7 +++++++ 2 files changed, 7 insertions(+) create mode 100644 tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png diff --git a/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png b/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..b811ad4993e45662faea2f52e69d44b4fb847501 GIT binary patch literal 13919 zcmeHN`Bzid7LF6t0nk#d$fV^}>T)4fjG#!Ub>R6BP$7iDfEpD|lqm!dNN{LD>j2h) zf((K(-H=4ofCQ4@1Xz`Tl0=3O5SbD}L`(t+N#41vzV`=owS8}O-SESKtb5McXYcR( z_P%Fxez&ie*}P@*P$-ny&VO#(i$cwALZM8){mcY>lb%TiU!Y75dV6g{8R4H>+|sKk z)N<6$ZCe5ob4Mi9iY$u0aZJ-2?Vo7*?v}$h&+g1F`UXF9?b4tfEhU9yQCHcy11>`u z>teezZmj8yn<-g@uKFeN#F0vqWs4*>n;Hlr~$epJSe$ z=wWBwxlybcpQK5}@e_kJat_bz1o+GW2B8W$6cs$8TCUGt2aiQ_55dDWOJF<-b#7(m z3@|M8Sw0I4%X7Yi5A)sn(+j|G>gY@>FrZqIiHLIm4iM!0P1r$E%4WEYPYwH}LOwS) zV7V?(v3U!P;Ta6K`L+HW%l?_VrBdN(j(2e!Sq0e>}k1y zQC?nNb-exKJyP=~d4>PF`S7`tK5uecF+T8$KFid+4)X9cjAh8nOYSzmXl)e(!MUKQe7Is;a6&YGMyFLfBAPV(*Wely&38 z$3M(PAO7_k@%ZtS=Tx0W$%;zVb+RKRoQ~RrDDK#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al 0 HcmV?d00001 diff --git a/tests/visual/text.spec.js b/tests/visual/text.spec.js index ec6de8e6..ad13e825 100644 --- a/tests/visual/text.spec.js +++ b/tests/visual/text.spec.js @@ -43,4 +43,11 @@ describe('text', function() { doc.fillColor('#000').list(['One', 'Two', 'Three'], 100, 150); }); }); + + test('list with line breaks in value', function() { + return runDocTest(function(doc) { + doc.font('tests/fonts/Roboto-Regular.ttf'); + doc.list(['Foo\nBar'], [100, 150]); + }) + }) }); From 7f85b5a2c423cf7725c8a1bf17cf54b2ef98777e Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Dec 2023 15:22:27 +0100 Subject: [PATCH 2/5] use LineBreaker per item and only draw `firstLine` once fixes #1486 --- lib/mixins/text.js | 123 ++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/lib/mixins/text.js b/lib/mixins/text.js index a1c7f425..1a958cde 100644 --- a/lib/mixins/text.js +++ b/lib/mixins/text.js @@ -153,73 +153,80 @@ export default { } }; - wrapper = new LineWrapper(this, options); - wrapper.on('line', this._line); + const drawItem = function(listItem) { + wrapper = new LineWrapper(this, options); + wrapper.on('line', this._line); + + level = 1; + let i = 0; + wrapper.once('firstLine', () => { + let item, itemType, labelType, bodyType; + if (options.structParent) { + if (options.structTypes) { + [itemType, labelType, bodyType] = options.structTypes; + } else { + [itemType, labelType, bodyType] = ['LI', 'Lbl', 'LBody']; + } + } - level = 1; - let i = 0; - wrapper.on('firstLine', () => { - let item, itemType, labelType, bodyType; - if (options.structParent) { - if (options.structTypes) { - [ itemType, labelType, bodyType ] = options.structTypes; - } else { - [ itemType, labelType, bodyType ] = [ 'LI', 'Lbl', 'LBody' ]; + if (itemType) { + item = this.struct(itemType); + options.structParent.add(item); + } else if (options.structParent) { + item = options.structParent; } - } - if (itemType) { - item = this.struct(itemType); - options.structParent.add(item); - } else if (options.structParent) { - item = options.structParent; - } + let l; + if ((l = levels[i++]) !== level) { + const diff = itemIndent * (l - level); + this.x += diff; + wrapper.lineWidth -= diff; + level = l; + } - let l; - if ((l = levels[i++]) !== level) { - const diff = itemIndent * (l - level); - this.x += diff; - wrapper.lineWidth -= diff; - level = l; - } + if (item && (labelType || bodyType)) { + item.add(this.struct(labelType || bodyType, + [this.markStructureContent(labelType || bodyType)])); + } + switch (listType) { + case 'bullet': + this.circle(this.x - indent + r, this.y + midLine, r); + this.fill(); + break; + case 'numbered': + case 'lettered': + var text = label(numbers[i - 1]); + this._fragment(text, this.x - indent, this.y, options); + break; + } - if (item && (labelType || bodyType)) { - item.add(this.struct(labelType || bodyType, - [ this.markStructureContent(labelType || bodyType) ])); - } - switch (listType) { - case 'bullet': - this.circle(this.x - indent + r, this.y + midLine, r); - this.fill(); - break; - case 'numbered': - case 'lettered': - var text = label(numbers[i - 1]); - this._fragment(text, this.x - indent, this.y, options); - break; - } + if (item && labelType && bodyType) { + item.add(this.struct(bodyType, [this.markStructureContent(bodyType)])); + } + if (item && item !== options.structParent) { + item.end(); + } + }); - if (item && labelType && bodyType) { - item.add(this.struct(bodyType, [ this.markStructureContent(bodyType) ])); - } - if (item && item !== options.structParent) { - item.end(); - } - }); + wrapper.on('sectionStart', () => { + const pos = indent + itemIndent * (level - 1); + this.x += pos; + return (wrapper.lineWidth -= pos); + }); - wrapper.on('sectionStart', () => { - const pos = indent + itemIndent * (level - 1); - this.x += pos; - return (wrapper.lineWidth -= pos); - }); + wrapper.on('sectionEnd', () => { + const pos = indent + itemIndent * (level - 1); + this.x -= pos; + return (wrapper.lineWidth += pos); + }); + + wrapper.wrap(listItem, options); + }; - wrapper.on('sectionEnd', () => { - const pos = indent + itemIndent * (level - 1); - this.x -= pos; - return (wrapper.lineWidth += pos); - }); - wrapper.wrap(items.join('\n'), options); + for (let i = 0; i < items.length; i++) { + drawItem.call(this, items[i]); + } return this; }, From 7c7d3cfac3978884834ee4537513db5b983cfb72 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Dec 2023 15:23:46 +0100 Subject: [PATCH 3/5] boyscout: consistent naming --- lib/mixins/text.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mixins/text.js b/lib/mixins/text.js index 1a958cde..d78f4465 100644 --- a/lib/mixins/text.js +++ b/lib/mixins/text.js @@ -153,7 +153,7 @@ export default { } }; - const drawItem = function(listItem) { + const drawListItem = function(listItem) { wrapper = new LineWrapper(this, options); wrapper.on('line', this._line); @@ -225,7 +225,7 @@ export default { for (let i = 0; i < items.length; i++) { - drawItem.call(this, items[i]); + drawListItem.call(this, items[i]); } return this; From 60cc300793f9aebef0e175a2abb3d6381e07ea6e Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Dec 2023 15:29:27 +0100 Subject: [PATCH 4/5] boyscout: test multiple line break versions --- ...xt-list-with-line-breaks-in-items-1-snap.png | Bin 0 -> 19096 bytes ...xt-list-with-line-breaks-in-value-1-snap.png | Bin 13919 -> 0 bytes tests/visual/text.spec.js | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-items-1-snap.png delete mode 100644 tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png diff --git a/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-items-1-snap.png b/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-items-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..fb76940d0c9c37037205b797b14c91be516ffcb1 GIT binary patch literal 19096 zcmeHvc~q14wl*zR>v5pg+gd4a7q~{3Ir}s!mL7_4l8zhTlY8C&MqqR-Z97`9VyC|J|+3 ziWd{xCPw_>z|p{z(cYjZ2`-f)QKxI&$a*c%B3q|T1kojpDKr0@o>$lHa5kRfP^D8hvSDv`R3(L2naW{y3lai=w}#NBe{6t4Cnf`s$0~ z`~j6|LK%>iOyf-eXMie&f`NrG*jg*&cFd$YMnhUp;hg zLT~Do(T05;EdQZaMXM}}#cD$C$rA6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;fC2DSOEnH!U`y0J*+SV z2*Q623UYDP@IvF?2>Aa6STV04WGluTR?mu82|-w~Zy^Z(CQxXPmBEp}*yp?w*@5Tq z?Mkr!eZhv6SK1*2;lFN&|E6qTIe?W(*uM=*|6e6nk=Tv`b#3XHRrlZy#E1tie#ra# HsZ0L{{K)PH literal 0 HcmV?d00001 diff --git a/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png b/tests/visual/__image_snapshots__/text-spec-js-text-list-with-line-breaks-in-value-1-snap.png deleted file mode 100644 index b811ad4993e45662faea2f52e69d44b4fb847501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13919 zcmeHN`Bzid7LF6t0nk#d$fV^}>T)4fjG#!Ub>R6BP$7iDfEpD|lqm!dNN{LD>j2h) zf((K(-H=4ofCQ4@1Xz`Tl0=3O5SbD}L`(t+N#41vzV`=owS8}O-SESKtb5McXYcR( z_P%Fxez&ie*}P@*P$-ny&VO#(i$cwALZM8){mcY>lb%TiU!Y75dV6g{8R4H>+|sKk z)N<6$ZCe5ob4Mi9iY$u0aZJ-2?Vo7*?v}$h&+g1F`UXF9?b4tfEhU9yQCHcy11>`u z>teezZmj8yn<-g@uKFeN#F0vqWs4*>n;Hlr~$epJSe$ z=wWBwxlybcpQK5}@e_kJat_bz1o+GW2B8W$6cs$8TCUGt2aiQ_55dDWOJF<-b#7(m z3@|M8Sw0I4%X7Yi5A)sn(+j|G>gY@>FrZqIiHLIm4iM!0P1r$E%4WEYPYwH}LOwS) zV7V?(v3U!P;Ta6K`L+HW%l?_VrBdN(j(2e!Sq0e>}k1y zQC?nNb-exKJyP=~d4>PF`S7`tK5uecF+T8$KFid+4)X9cjAh8nOYSzmXl)e(!MUKQe7Is;a6&YGMyFLfBAPV(*Wely&38 z$3M(PAO7_k@%ZtS=Tx0W$%;zVb+RKRoQ~RrDDK#$s0uoZ$Jue&=H$FmQ?PKD)9H(r zA9Yfr;o7MDxO@Ca8HvTM3S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/visual/text.spec.js +++ b/tests/visual/text.spec.js @@ -44,10 +44,10 @@ describe('text', function() { }); }); - test('list with line breaks in value', function() { + test('list with line breaks in items', function() { return runDocTest(function(doc) { doc.font('tests/fonts/Roboto-Regular.ttf'); - doc.list(['Foo\nBar'], [100, 150]); + doc.list(['Foo\nBar', 'Foo\rBar', 'Foo\r\nBar'], [100, 150]); }) }) }); From 7704436d2ff7d076b294e5dae668cbd974d9141c Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Dec 2023 15:29:57 +0100 Subject: [PATCH 5/5] update changelog for fix of #1486 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8484fc9a..a24e1063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Unreleased - Add subset for PDF/UA +- Fix for line breaks in list items (#1486) ### [v0.14.0] - 2023-11-09