Fixed bug #891775: When the theme is bottom-aligned, stop the tails of y and g from being chopped off.

bzr-revno: 1914
Fixes: https://launchpad.net/bugs/891775
This commit is contained in:
Jonathan Corwin 2012-03-22 23:02:23 +02:00 committed by Raoul Snyman
commit d6e3ed6ae1
2 changed files with 10 additions and 4 deletions

View File

@ -458,13 +458,18 @@ def build_lyrics_format_css(theme, width, height):
# fix tag incompatibilities
if theme.display_horizontal_align == HorizontalType.Justify:
justify = u''
if theme.display_vertical_align == VerticalType.Bottom:
padding_bottom = u'0.5em'
else:
padding_bottom = u'0'
lyrics = u'%s word-wrap: break-word; ' \
'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'padding: 0; padding-left: %spx; width: %spx; height: %spx; ' % \
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx;' \
'height: %spx; ' % \
(justify, align, valign, theme.font_main_name, theme.font_main_size,
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
left_margin, width, height)
padding_bottom, left_margin, width, height)
if theme.font_main_outline:
if webkit_version() <= 534.3:
lyrics += u' letter-spacing: 1px;'

View File

@ -289,7 +289,7 @@ class Renderer(object):
def _calculate_default(self):
"""
Calculate the default dimentions of the screen.
Calculate the default dimensions of the screen.
"""
screen_size = self.screens.current[u'size']
self.width = screen_size.width()
@ -380,6 +380,7 @@ class Renderer(object):
(build_lyrics_format_css(self.theme_data, self.page_width,
self.page_height), build_lyrics_outline_css(self.theme_data))
self.web.setHtml(html)
self.empty_height = self.web_frame.contentsSize().height()
def _paginate_slide(self, lines, line_end):
"""
@ -600,7 +601,7 @@ class Renderer(object):
"""
self.web_frame.evaluateJavaScript(u'show_text("%s")' %
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
return self.web_frame.contentsSize().height() <= self.page_height
return self.web_frame.contentsSize().height() <= self.empty_height
def _words_split(self, line):
"""