PDF Output: Make the minimum height for headers and footers scale with the base font size

This commit is contained in:
Kovid Goyal 2015-01-08 09:42:16 +05:30
parent 8942e8e658
commit bcd8bcdcb5
2 changed files with 4 additions and 3 deletions

View File

@ -1153,6 +1153,7 @@ OptionRecommendation(name='search_replace',
specializer=partial(self.output_plugin.specialize_css_for_output,
self.log, self.opts))
flattener(self.oeb, self.opts)
self.opts._final_base_font_size = fbase
self.opts.insert_blank_line = oibl
self.opts.remove_paragraph_spacing = orps

View File

@ -192,12 +192,12 @@ class PDFWriter(QObject):
self.header = opts.pdf_header_template
if self.header:
self.header = self.header.strip()
min_margin = 36
min_margin = 1.5 * opts._final_base_font_size
if self.footer and opts.margin_bottom < min_margin:
self.log.warn('Bottom margin is too small for footer, increasing it.')
self.log.warn('Bottom margin is too small for footer, increasing it to %.1fpts' % min_margin)
opts.margin_bottom = min_margin
if self.header and opts.margin_top < min_margin:
self.log.warn('Top margin is too small for header, increasing it.')
self.log.warn('Top margin is too small for header, increasing it to %.1fpts' % min_margin)
opts.margin_top = min_margin
self.page.setViewportSize(QSize(self.doc.width(), self.doc.height()))