mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 06:13:41 +02:00
MOBI Output: Specify image sizes in pixels instead of em to accomodate Amazon's @#$%#@! MOBI renderer
This commit is contained in:
parent
9ae6c11a28
commit
6bd56c0d5b
1 changed files with 6 additions and 2 deletions
|
|
@ -363,11 +363,15 @@ def mobimlize_elem(self, elem, stylizer, bstate, istates,
|
|||
if value == getattr(self.profile, prop):
|
||||
result = '100%'
|
||||
else:
|
||||
# Amazon's renderer does not support
|
||||
# img sizes in units other than px
|
||||
# See #7520 for test case
|
||||
try:
|
||||
ems = int(round(float(value) / self.profile.fbase))
|
||||
pixs = int(round(float(value) / \
|
||||
(72./self.profile.dpi)))
|
||||
except:
|
||||
continue
|
||||
result = "%dem" % ems
|
||||
result = "%d"%pixs
|
||||
istate.attrib[prop] = result
|
||||
elif tag == 'hr' and asfloat(style['width']) > 0:
|
||||
prop = style['width'] / self.profile.width
|
||||
|
|
|
|||
Loading…
Reference in a new issue