mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a regression in 3.45.0 caused by py3 porting that broke rasterization of SVG images when converting to formats such as MOBI that do not support SVG. Fixes #1836463 [Private bug](https://bugs.launchpad.net/calibre/+bug/1836463)
This commit is contained in:
parent
bae5d86600
commit
c1e6aca8e0
@ -121,10 +121,10 @@ class SVGRasterizer(object):
|
||||
if abshref not in hrefs:
|
||||
continue
|
||||
linkee = hrefs[abshref]
|
||||
data = unicode_type(linkee)
|
||||
data = linkee.bytes_representation
|
||||
ext = what(None, data) or 'jpg'
|
||||
with PersistentTemporaryFile(suffix='.'+ext) as pt:
|
||||
pt.write(data.encode('utf-8'))
|
||||
pt.write(data)
|
||||
self.temp_files.append(pt.name)
|
||||
elem.attrib[XLINK('href')] = pt.name
|
||||
return svg
|
||||
@ -182,7 +182,7 @@ class SVGRasterizer(object):
|
||||
height = style['height']
|
||||
width = (width / 72) * self.profile.dpi
|
||||
height = (height / 72) * self.profile.dpi
|
||||
data = QByteArray(unicode_type(svgitem).encode('utf-8'))
|
||||
data = QByteArray(svgitem.bytes_representation)
|
||||
svg = QSvgRenderer(data)
|
||||
size = svg.defaultSize()
|
||||
size.scale(width, height, Qt.KeepAspectRatio)
|
||||
|
Loading…
x
Reference in New Issue
Block a user