From a7332d178a53fbc99e5f668f2a71d85a1a4ee82d Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Sun, 11 Sep 2011 15:32:32 +0200 Subject: [PATCH] Fix a small error in font encoding --- pdf.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdf.js b/pdf.js index b4fe814c2..f279e0cdc 100644 --- a/pdf.js +++ b/pdf.js @@ -4939,7 +4939,6 @@ var CanvasGraphics = (function() { } var composite = font.composite; - var encoding = font.encoding; var fontSize = current.fontSize; var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; @@ -4956,7 +4955,9 @@ var CanvasGraphics = (function() { var charcode = originalText.charCodeAt(i); } - var charWidth = font.encoding[charcode].width * fontSize * 0.001; + var encoding = font.encoding[charcode]; + var charWidth = (encoding ? encoding.width : font.defaultWidth); + charWidth *= (fontSize * 0.001); charWidth += charSpacing; if (charcode == 32) charWidth += wordSpacing;