mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-14 11:35:01 +01:00
...
This commit is contained in:
parent
218de802ba
commit
1dacfc5709
1 changed files with 8 additions and 1 deletions
|
|
@ -21,10 +21,17 @@
|
|||
|
||||
Image = namedtuple('Image', 'rid fname width height fmt item')
|
||||
|
||||
def as_num(x):
|
||||
try:
|
||||
return float(x)
|
||||
except Exception:
|
||||
pass
|
||||
return 0
|
||||
|
||||
def get_image_margins(style):
|
||||
ans = {}
|
||||
for edge in 'Left Right Top Bottom'.split():
|
||||
val = getattr(style, 'padding' + edge) + getattr(style, 'margin' + edge)
|
||||
val = as_num(getattr(style, 'padding' + edge)) + as_num(getattr(style, 'margin' + edge))
|
||||
ans['dist' + edge[0]] = str(pt_to_emu(val))
|
||||
return ans
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue