mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -363,11 +363,15 @@ class MobiMLizer(object):
|
|||||||
if value == getattr(self.profile, prop):
|
if value == getattr(self.profile, prop):
|
||||||
result = '100%'
|
result = '100%'
|
||||||
else:
|
else:
|
||||||
|
# Amazon's renderer does not support
|
||||||
|
# img sizes in units other than px
|
||||||
|
# See #7520 for test case
|
||||||
try:
|
try:
|
||||||
ems = int(round(float(value) / self.profile.fbase))
|
pixs = int(round(float(value) / \
|
||||||
|
(72./self.profile.dpi)))
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
result = "%dem" % ems
|
result = "%d"%pixs
|
||||||
istate.attrib[prop] = result
|
istate.attrib[prop] = result
|
||||||
elif tag == 'hr' and asfloat(style['width']) > 0:
|
elif tag == 'hr' and asfloat(style['width']) > 0:
|
||||||
prop = style['width'] / self.profile.width
|
prop = style['width'] / self.profile.width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user