]> git.parisson.com Git - pdf.js.git/commitdiff
Scale text divs instead of letterspacing
authorAdil Allawi <adil@diwan.com>
Sun, 12 Feb 2012 22:31:30 +0000 (22:31 +0000)
committerAdil Allawi <adil@diwan.com>
Sun, 12 Feb 2012 22:31:30 +0000 (22:31 +0000)
web/viewer.js

index d5162a194d6fe5631b6bed5e6dbfaf5001c30117..9cf97a75179ae8136fa83a6c2dfc3436b1e10085 100644 (file)
@@ -1041,12 +1041,11 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
         textLayerDiv.appendChild(textDiv);
 
         if (textDiv.dataset.textLength > 1) { // avoid div by zero
-          // Adjust div width (via letterSpacing) to match canvas text
+          // Adjust div width to match canvas text
           // Due to the .offsetWidth calls, this is slow
           // This needs to come after appending to the DOM
-          textDiv.style.letterSpacing =
-            ((textDiv.dataset.canvasWidth - textDiv.offsetWidth) /
-              (textDiv.dataset.textLength - 1)) + 'px';
+          textDiv.style.MozTransform = 'scale(' + textDiv.dataset.canvasWidth/textDiv.offsetWidth + ',1)';
+          textDiv.style.MozTransformOrigin = '0% 0%';
         }
       } // textLength > 0
     }