]> git.parisson.com Git - pdf.js.git/commitdiff
Ensure single chars are added to the layer
authorArtur Adib <arturadib@gmail.com>
Wed, 18 Jan 2012 16:41:13 +0000 (11:41 -0500)
committerArtur Adib <arturadib@gmail.com>
Wed, 18 Jan 2012 16:41:13 +0000 (11:41 -0500)
web/viewer.js

index 72c154bc16d339d8acc497885bde1486d191ec56..319946ce6e6ad8063f16957cf8ce321c2be94a8f 100644 (file)
@@ -974,13 +974,13 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
       }
       var textDiv = textDivs.shift();
       if (textDiv.dataset.textLength > 1) { // avoid div by zero
-        textLayerDiv.appendChild(textDiv);
         // Adjust div width (via letterSpacing) to match canvas text
         // Due to the .offsetWidth calls, this is slow
         textDiv.style.letterSpacing =
           ((textDiv.dataset.canvasWidth - textDiv.offsetWidth) /
             (textDiv.dataset.textLength - 1)) + 'px';
       }
+      textLayerDiv.appendChild(textDiv);
     }
     renderTimer = setInterval(renderTextLayer, renderInterval);