From a983bf4720b2024e9812497fddf55e386de05daa Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Sat, 18 Jan 2014 13:21:30 -0800 Subject: [PATCH] Make encodeWinAnsi and associated map private --- lib/font.coffee | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/font.coffee b/lib/font.coffee index c36f762..9ff5031 100644 --- a/lib/font.coffee +++ b/lib/font.coffee @@ -33,8 +33,8 @@ class PDFFont return fn() if @isAFM @embedTTF fn - _WinAnsiMap: { - 402: 131 + WIN_ANSI_MAP = + 402: 131 8211: 150 8212: 151 8216: 145 @@ -51,30 +51,29 @@ class PDFFont 8240: 137 8249: 139 8250: 155 - 710: 136 + 710: 136 8482: 153 - 338: 140 - 339: 156 - 732: 152 - 352: 138 - 353: 154 - 376: 159 - 381: 142 - 382: 158 - } + 338: 140 + 339: 156 + 732: 152 + 352: 138 + 353: 154 + 376: 159 + 381: 142 + 382: 158 - _encodeWinAnsi: (text) -> + encodeWinAnsi = (text) -> string = '' for i in [0...text.length] char = text.charCodeAt(i) - char = @_WinAnsiMap[char] || char + char = WIN_ANSI_MAP[char] || char string += String.fromCharCode(char) return string encode: (text) -> if @isAFM - @_encodeWinAnsi text + encodeWinAnsi text else @subset?.encodeText(text) or text