Tim Bentley has proposed merging lp:~trb143/openlp/fixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


More rendering and font sizing fixes.
-- 
https://code.launchpad.net/~trb143/openlp/fixes/+merge/13857
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-10-22 19:07:32 +0000
+++ openlp/core/lib/renderer.py	2009-10-23 16:20:26 +0000
@@ -169,6 +169,8 @@
         page_length = int(self._rect.height() / metrics.height() - 2 ) - 1
         ave_line_width = line_width / metrics.averageCharWidth()
         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 = []
         page = []
         split_lines = []
@@ -195,15 +197,17 @@
                     else:
                         split_text = line[:pos]
                 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 len(line) > 0 :
+                if len(line) > 0 and self._theme.font_main_indentation > 0:
                     line = u'%s%s' % \
                         (u'          '[:self._theme.font_main_indentation], line)
                 #Text fits in a line now
-        for line in split_lines:
+        for count, line in enumerate(split_lines):
             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)
                 page = []
         if len(page) > 0 and page != u' ':

=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py	2009-10-22 19:03:08 +0000
+++ openlp/core/lib/themexmlhandler.py	2009-10-23 16:20:26 +0000
@@ -52,7 +52,7 @@
       <weight>Normal</weight>
       <italics>False</italics>
       <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 type="footer">
       <name>Arial</name>
@@ -61,7 +61,7 @@
       <weight>Normal</weight>
       <italics>False</italics>
       <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>
    <display>
       <shadow color="#000000">True</shadow>

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-10-22 19:03:08 +0000
+++ openlp/core/ui/amendthemeform.py	2009-10-23 16:20:26 +0000
@@ -674,8 +674,11 @@
                          int(self.theme.font_main_proportion), # size
                          int(main_weight), # weight
                          self.theme.font_main_italics)# italic
+            mainFont.setPixelSize(int(self.theme.font_main_proportion))
             metrics = QtGui.QFontMetrics(mainFont)
             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(
                 translate(u'ThemeManager', u'Slide Height is %s rows' % page_length  ))
             frame = self.thememanager.generateImage(theme)

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to