This commit is contained in:
Kovid Goyal 2008-03-22 23:50:15 +00:00
parent ef2f732de3
commit 32eb513022
2 changed files with 7 additions and 0 deletions

View File

@ -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):

View File

@ -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))))