← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/bug-859950 into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/bug-859950 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #859950 in OpenLP: "theme with outlined text and "justify" not displaying properly"
  https://bugs.launchpad.net/openlp/+bug/859950

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/bug-859950/+merge/84859

Workaround an outline alignment problem when horizontal alignment is set to Justify.

This appears to fix the problem on Windows. 

Tim has told me there is still a problem on his system, but it's going to be a difficult for me to investigate that. It would be interesting to know if this fixes it for other Linux or OSX or if it is a Windows only fix.
-- 
https://code.launchpad.net/~j-corwin/openlp/bug-859950/+merge/84859
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/bug-859950 into lp:openlp.
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py	2011-12-01 18:08:12 +0000
+++ openlp/core/lib/htmlbuilder.py	2011-12-07 22:40:23 +0000
@@ -85,6 +85,7 @@
 <script>
     var timer = null;
     var transition = %s;
+    var webkitvers = %s;
     %s
 
     function show_image(src){
@@ -129,6 +130,19 @@
         var match = /-webkit-text-fill-color:[^;\"]+/gi;
         if(timer != null)
             clearTimeout(timer);
+        /* QtWebkit bug with outlines and justify causing outline alignment problems. (Bug 859950)
+           Surround each word with a <span> to workaround, but only in this scenario. */
+        if(webkitvers<=534.3){
+            var txt = document.getElementById('lyricsmain');
+            if(window.getComputedStyle(txt).textAlign=='justify'){
+                var outline = document.getElementById('lyricsoutline');
+                if(outline!=null)
+                    txt = outline;
+                if(window.getComputedStyle(txt).webkitTextStrokeWidth!="0px"){
+                    newtext = '<span>' + newtext.replace(/[ ](?![^<]*>)/g, "</span> <span>") + '</span>';
+                }
+            }
+        }
         text_fade('lyricsmain', newtext);
         text_fade('lyricsoutline', newtext);
         text_fade('lyricsshadow', newtext.replace(match, ""));
@@ -239,6 +253,7 @@
         build_lyrics_css(item, webkitvers),
         u'true' if theme and theme.display_slide_transition and islive \
             else u'false',
+        webkitvers,
         js_additions,
         bgimage_src, image_src,
         html_additions,


Follow ups