diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index b1626637a..e9029f692 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -76,27 +76,24 @@ var TextLayerBuilder = function textLayerBuilder(options) { if ('isWhitespace' in textDiv.dataset) { continue; } - textLayerFrag.appendChild(textDiv); ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily; var width = ctx.measureText(textDiv.textContent).width; if (width > 0) { + textLayerFrag.appendChild(textDiv); var textScale = textDiv.dataset.canvasWidth / width; var rotation = textDiv.dataset.angle; var transform = 'scale(' + textScale + ', 1)'; transform = 'rotate(' + rotation + 'deg) ' + transform; CustomStyle.setProp('transform' , textDiv, transform); CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%'); - - textLayerDiv.appendChild(textDiv); } } + textLayerDiv.appendChild(textLayerFrag); this.renderingDone = true; this.updateMatches(); - - textLayerDiv.appendChild(textLayerFrag); }; this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {