← 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/85017

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.

***
Removed the version check, since we don't know if it's fixed in newer versions (I was hoping it was fixed with other alignment issues that have been fixed).

Tidied up spaces because Raoul isn't a computer.


-- 
https://code.launchpad.net/~j-corwin/openlp/bug-859950/+merge/85017
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-08 19:51:29 +0000
@@ -113,10 +113,10 @@
         document.getElementById('lyricsmain').style.visibility = lyrics;
         document.getElementById('image').style.visibility = lyrics;
         outline = document.getElementById('lyricsoutline')
-        if(outline!=null)
+        if(outline != null)
             outline.style.visibility = lyrics;
         shadow = document.getElementById('lyricsshadow')
-        if(shadow!=null)
+        if(shadow != null)
             shadow.style.visibility = lyrics;
         document.getElementById('footer').style.visibility = lyrics;
     }
@@ -129,10 +129,25 @@
         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. 
+        */
+        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, ""));
-        if(text_opacity()==1) return;
+        text_fade('lyricsshadow', newtext.replace(match, ''));
+        if(text_opacity() == 1) return;
         timer = setTimeout(function(){
             show_text(newtext);
         }, 100);
@@ -149,18 +164,18 @@
         slides) still looks pretty and is zippy.
         */
         var text = document.getElementById(id);
-        if(text==null) return;
+        if(text == null) return;
         if(!transition){
             text.innerHTML = newtext;
             return;
         }
-        if(newtext==text.innerHTML){
+        if(newtext == text.innerHTML){
             text.style.opacity = parseFloat(text.style.opacity) + 0.3;
-            if(text.style.opacity>0.7)
+            if(text.style.opacity > 0.7)
                 text.style.opacity = 1;
         } else {
             text.style.opacity = parseFloat(text.style.opacity) - 0.3;
-            if(text.style.opacity<=0.1){
+            if(text.style.opacity <= 0.1){
                 text.innerHTML = newtext;
             }
         }
@@ -172,7 +187,7 @@
     }
 
     function show_text_complete(){
-        return (text_opacity()==1);
+        return (text_opacity() == 1);
     }
 </script>
 </head>


Follow ups