From 08eb9a960adc7cbd8eda74ae89135f915a55cc25 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 30 Mar 2014 13:36:21 +0200 Subject: [PATCH] Avoid drawing text when the font size is zero (issue 4484) --- src/display/canvas.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/display/canvas.js b/src/display/canvas.js index bcb851640..74a100c1c 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -1322,6 +1322,19 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { var vertical = font.vertical; var defaultVMetrics = font.defaultVMetrics; + if (fontSize === 0) { + if (textSelection) { + geom = this.createTextGeometry(); + geom.canvasWidth = canvasWidth; + if (vertical) { + var VERTICAL_TEXT_ROTATION = Math.PI / 2; + geom.angle += VERTICAL_TEXT_ROTATION; + } + this.textLayer.appendText(geom); + } + return canvasWidth; + } + // Type3 fonts - each glyph is a "mini-PDF" if (font.coded) { ctx.save();