View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0016767||Scribus||public||2022-03-05 23:10||2022-03-08 18:28|
|Fixed in Version||1.5.9.svn|
|Summary||0016767: Dashed lines imported from PDF have incorrect segment lengths|
|Description||When displaying a PDF, the lengths of segments in dashed lines appear to be erroneously scaled based on the line's width.|
|Steps To Reproduce||The attached dashes.pdf has three different dashed line patterns. Each pattern is drawn in 3 different widths: 0.5pt, 1pt, and 2pt.|
If you view this file in Acrobat, Firefox, etc., you can see that for each pattern, the dash segment lengths match for all three line widths.
If you open this file in Scribus, it draws the dashes (and gaps) too long for the 0.5pt lines and too short for the 2pt lines. (The 1pt-wide line is correct.) Scribus appears to be using dash (and gap) lengths equal to the specified length divided by the line's width.
|Additional Information||dashes.tex is provided just for reference; I created it to generate the example dashes.pdf.|
This is not a new bug; it happens in previous 1.5.x and 1.4.x versions. I've always just worked around it by scaling the pattern that I generate.
|Tags||dashed lines, lines, pdf import|
dashes.pdf (18,813 bytes)
dashes.tex (1,804 bytes)
||dashes-Scribus.gif shows a screen shot of the dashes displayed by Scribus when opening dashes.pdf|
I think the issue may be related to differences in how PDF and Qt represent dash patterns.
* Qt documentation states that "The dash pattern is specified in units of the pens width." <https://doc.qt.io/qt-5/qpen.html#setDashPattern>
* The lengths for a dash pattern in a PDF are specified in "user space units" (pts in my example file), and are thus independent of line width.
This would indicate needing to take the PDF values and divide by line width to get the values needed by Qt. But the result I see in Scribus indicates that this conversion may have been applied twice.
||In fact we do not use Qt for drawing to screen, but cairo graphics library. However it seems that some of our importer code was copied from poppler's qt support library and there was indeed an incorrect division of dashes values by line width. Removed it, and things now works better :-)|
||Thank you! And thanks for the explanation; that would explain why I saw cairo references in the code :-)|
|2022-03-05 23:10||cathysax||New Issue|
|2022-03-05 23:10||cathysax||Tag Attached: dashed lines|
|2022-03-05 23:10||cathysax||Tag Attached: lines|
|2022-03-05 23:10||cathysax||Tag Attached: pdf import|
|2022-03-05 23:10||cathysax||File Added: dashes.pdf|
|2022-03-05 23:10||cathysax||File Added: dashes.tex|
|2022-03-05 23:24||cathysax||Note Added: 0049584|
|2022-03-05 23:24||cathysax||File Added: dashes-Scribus.gif|
|2022-03-07 19:30||cathysax||Note Added: 0049585|
|2022-03-07 22:03||jghali||Summary||Dashed lines from PDF have incorrect segment lengths => Dashed lines imported from PDF have incorrect segment lengths|
|2022-03-07 22:12||jghali||Assigned To||=> jghali|
|2022-03-07 22:12||jghali||Status||new => resolved|
|2022-03-07 22:12||jghali||Resolution||open => fixed|
|2022-03-07 22:12||jghali||Fixed in Version||=> 1.5.9.svn|
|2022-03-07 22:12||jghali||Note Added: 0049586|
|2022-03-08 18:28||cathysax||Note Added: 0049587|