From 6acc9c00e61c998b15e8af3ad9f9a7317e3cd407 Mon Sep 17 00:00:00 2001 From: thejdeep Date: Tue, 14 Oct 2014 22:37:01 +0530 Subject: [PATCH] Black text not visible #5291 Issue #5291 black text not visible Optimized code --- src/display/canvas.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/display/canvas.js b/src/display/canvas.js index de0a2ccd058fa5..8ca7e4829fd16c 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -26,6 +26,8 @@ // Minimal font size that would be used during canvas fillText operations. var MIN_FONT_SIZE = 16; +// Maximum font size that would be used during canvas fillText operations. +var MAX_FONT_SIZE = 50; var MAX_GROUP_SIZE = 4096; var COMPILE_TYPE3_GLYPHS = true; @@ -1226,8 +1228,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { // Keeping the font at minimal size and using the fontSizeScale to change // the current transformation matrix before the fillText/strokeText. // See https://bugzilla.mozilla.org/show_bug.cgi?id=726227 - var browserFontSize = size >= MIN_FONT_SIZE ? size : MIN_FONT_SIZE; - this.current.fontSizeScale = browserFontSize !== MIN_FONT_SIZE ? 1.0 : + var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : + size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; + this.current.fontSizeScale = browserFontSize === size ? 1.0 : size / MIN_FONT_SIZE; var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;