PDF Output: Fix "stroke-dasharray" lines in SVG images in the input document not being rendered correctly. Fixes #1821923 [ebook-convert pdf plugin does not render dasharray](https://bugs.launchpad.net/calibre/+bug/1821923)

Merge branch 'master' of https://github.com/jimbojw/calibre
This commit is contained in:
Kovid Goyal 2019-03-27 19:54:30 +05:30
commit 080c19b966
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -44,6 +44,7 @@ def convert_path(path): # {{{
return p return p
# }}} # }}}
Brush = namedtuple('Brush', 'origin brush color') Brush = namedtuple('Brush', 'origin brush color')
@ -430,9 +431,12 @@ class Graphics(object):
pdf.current_page.write('%d j '%join) pdf.current_page.write('%d j '%join)
# Dash pattern # Dash pattern
ps = {Qt.DashLine:[3], Qt.DotLine:[1,2], Qt.DashDotLine:[3,2,1,2], if pen.style() == Qt.CustomDashLine:
Qt.DashDotDotLine:[3, 2, 1, 2, 1, 2]}.get(pen.style(), []) pdf.serialize(Array(pen.dashPattern()))
if ps: pdf.current_page.write(' %d d ' % pen.dashOffset())
else:
ps = {Qt.DashLine:[3], Qt.DotLine:[1,2], Qt.DashDotLine:[3,2,1,2],
Qt.DashDotDotLine:[3, 2, 1, 2, 1, 2]}.get(pen.style(), [])
pdf.serialize(Array(ps)) pdf.serialize(Array(ps))
pdf.current_page.write(' 0 d ') pdf.current_page.write(' 0 d ')
@ -482,5 +486,3 @@ class Graphics(object):
pat = TexturePattern(None, matrix, self.pdf, clone=self.last_fill.brush) pat = TexturePattern(None, matrix, self.pdf, clone=self.last_fill.brush)
pattern = self.pdf.add_pattern(pat) pattern = self.pdf.add_pattern(pat)
self.pdf.apply_fill(self.last_fill.color, pattern) self.pdf.apply_fill(self.last_fill.color, pattern)