mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #596
This commit is contained in:
parent
ef2f732de3
commit
32eb513022
@ -1079,6 +1079,10 @@ class HTMLConverter(object):
|
|||||||
if 2*int(ans['sidemargin']) >= factor*int(self.current_block.blockStyle.attrs['blockwidth']):
|
if 2*int(ans['sidemargin']) >= factor*int(self.current_block.blockStyle.attrs['blockwidth']):
|
||||||
ans['sidemargin'] = int((factor*int(self.current_block.blockStyle.attrs['blockwidth']))/2.)
|
ans['sidemargin'] = int((factor*int(self.current_block.blockStyle.attrs['blockwidth']))/2.)
|
||||||
|
|
||||||
|
for prop in ('topskip', 'footskip', 'sidemargin'):
|
||||||
|
if ans[prop] < 0:
|
||||||
|
ans[prop] = 0
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def font_properties(self, css):
|
def font_properties(self, css):
|
||||||
|
@ -78,8 +78,11 @@ def writeByte(f, byte):
|
|||||||
def writeWord(f, word):
|
def writeWord(f, word):
|
||||||
if int(word) > 65535:
|
if int(word) > 65535:
|
||||||
raise LrfError('Cannot encode a number greater than 65535 in a word.')
|
raise LrfError('Cannot encode a number greater than 65535 in a word.')
|
||||||
|
if int(word) < 0:
|
||||||
|
raise LrfError('Cannot encode a number < 0 in a word: '+str(word))
|
||||||
f.write(struct.pack("<H", int(word)))
|
f.write(struct.pack("<H", int(word)))
|
||||||
|
|
||||||
|
|
||||||
def writeSignedWord(f, sword):
|
def writeSignedWord(f, sword):
|
||||||
f.write(struct.pack("<h", int(float(sword))))
|
f.write(struct.pack("<h", int(float(sword))))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user