forked from openlp/openlp
Font Sizing and rendering improvements
bzr-revno: 619
This commit is contained in:
commit
d98b6c7e88
@ -169,6 +169,8 @@ class Renderer(object):
|
|||||||
page_length = int(self._rect.height() / metrics.height() - 2 ) - 1
|
page_length = int(self._rect.height() / metrics.height() - 2 ) - 1
|
||||||
ave_line_width = line_width / metrics.averageCharWidth()
|
ave_line_width = line_width / metrics.averageCharWidth()
|
||||||
ave_line_width = int(ave_line_width + (ave_line_width * 1))
|
ave_line_width = int(ave_line_width + (ave_line_width * 1))
|
||||||
|
log.debug(u'Page Length area height %s , metrics %s , lines %s' %
|
||||||
|
(int(self._rect.height()), metrics.height(), page_length ))
|
||||||
split_pages = []
|
split_pages = []
|
||||||
page = []
|
page = []
|
||||||
split_lines = []
|
split_lines = []
|
||||||
@ -195,15 +197,17 @@ class Renderer(object):
|
|||||||
else:
|
else:
|
||||||
split_text = line[:pos]
|
split_text = line[:pos]
|
||||||
split_lines.append(split_text)
|
split_lines.append(split_text)
|
||||||
line = line[pos:]
|
line = line[pos:].lstrip()
|
||||||
#if we have more text add up to 10 spaces on the front.
|
#if we have more text add up to 10 spaces on the front.
|
||||||
if len(line) > 0 :
|
if len(line) > 0 and self._theme.font_main_indentation > 0:
|
||||||
line = u'%s%s' % \
|
line = u'%s%s' % \
|
||||||
(u' '[:self._theme.font_main_indentation], line)
|
(u' '[:self._theme.font_main_indentation], line)
|
||||||
#Text fits in a line now
|
#Text fits in a line now
|
||||||
for line in split_lines:
|
for count, line in enumerate(split_lines):
|
||||||
page.append(line)
|
page.append(line)
|
||||||
if len(page) == page_length:
|
#last but one line and only 2 lines to go or end of page
|
||||||
|
if (len(page) == page_length - 1 and len(split_lines) - 3 == count) or \
|
||||||
|
len(page) == page_length:
|
||||||
split_pages.append(page)
|
split_pages.append(page)
|
||||||
page = []
|
page = []
|
||||||
if len(page) > 0 and page != u' ':
|
if len(page) > 0 and page != u' ':
|
||||||
|
@ -52,7 +52,7 @@ blankthemexml=\
|
|||||||
<weight>Normal</weight>
|
<weight>Normal</weight>
|
||||||
<italics>False</italics>
|
<italics>False</italics>
|
||||||
<indentation>0</indentation>
|
<indentation>0</indentation>
|
||||||
<location override="False" x="0" y="0" width="0" height="0"/>
|
<location override="False" x="10" y="10" width="1024" height="730"/>
|
||||||
</font>
|
</font>
|
||||||
<font type="footer">
|
<font type="footer">
|
||||||
<name>Arial</name>
|
<name>Arial</name>
|
||||||
@ -61,7 +61,7 @@ blankthemexml=\
|
|||||||
<weight>Normal</weight>
|
<weight>Normal</weight>
|
||||||
<italics>False</italics>
|
<italics>False</italics>
|
||||||
<indentation>0</indentation>
|
<indentation>0</indentation>
|
||||||
<location override="False" x="0" y="0" width="0" height="0"/>
|
<location override="False" x="10" y="730" width="1024" height="38"/>
|
||||||
</font>
|
</font>
|
||||||
<display>
|
<display>
|
||||||
<shadow color="#000000">True</shadow>
|
<shadow color="#000000">True</shadow>
|
||||||
|
@ -674,8 +674,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
int(self.theme.font_main_proportion), # size
|
int(self.theme.font_main_proportion), # size
|
||||||
int(main_weight), # weight
|
int(main_weight), # weight
|
||||||
self.theme.font_main_italics)# italic
|
self.theme.font_main_italics)# italic
|
||||||
|
mainFont.setPixelSize(int(self.theme.font_main_proportion))
|
||||||
metrics = QtGui.QFontMetrics(mainFont)
|
metrics = QtGui.QFontMetrics(mainFont)
|
||||||
page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2 ) - 1
|
page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2 ) - 1
|
||||||
|
log.debug(u'Page Length area height %s , metrics %s , lines %s' %
|
||||||
|
(int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length ))
|
||||||
self.FontMainLinesPageLabel.setText(
|
self.FontMainLinesPageLabel.setText(
|
||||||
translate(u'ThemeManager', u'Slide Height is %s rows' % page_length ))
|
translate(u'ThemeManager', u'Slide Height is %s rows' % page_length ))
|
||||||
frame = self.thememanager.generateImage(theme)
|
frame = self.thememanager.generateImage(theme)
|
||||||
|
Loading…
Reference in New Issue
Block a user