From c9ee7b9bfa77d696bb315199ff4f0232daa54b24 Mon Sep 17 00:00:00 2001 From: vyv03354 Date: Sat, 2 Mar 2013 11:02:35 +0900 Subject: [PATCH] Implement "90pv" CMap --- src/fonts.js | 13 +++++++++++++ test/pdfs/P020121130574743273239.pdf.link | 1 + test/test_manifest.json | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 test/pdfs/P020121130574743273239.pdf.link diff --git a/src/fonts.js b/src/fonts.js index 10c0819f7..b8911a802 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -412,6 +412,7 @@ var CMapConverterList = { 'EUC-H': eucjpToUnicode, 'EUC-V': eucjpToUnicode, '83pv-RKSJ-H': sjis83pvToUnicode, + '90pv-RKSJ-H': sjis90pvToUnicode, '90ms-RKSJ-H': sjisToUnicode, '90ms-RKSJ-V': sjisToUnicode, '90msp-RKSJ-H': sjisToUnicode, @@ -479,6 +480,18 @@ function sjis83pvToUnicode(str) { } } +function sjis90pvToUnicode(str) { + var bytes = stringToBytes(str); + try { + // TODO: 90pv has incompatible mappings in 8740..879c and eb41..ee9c. + return decodeBytes(bytes, 'shift_jis', true); + } catch (e) { + TODO('Unsupported 90pv character found'); + // Just retry without checking errors for now. + return decodeBytes(bytes, 'shift_jis'); + } +} + function gbkToUnicode(str) { return decodeBytes(stringToBytes(str), 'gbk'); } diff --git a/test/pdfs/P020121130574743273239.pdf.link b/test/pdfs/P020121130574743273239.pdf.link new file mode 100644 index 000000000..afd037654 --- /dev/null +++ b/test/pdfs/P020121130574743273239.pdf.link @@ -0,0 +1 @@ +http://image.haier.com/manual/japan/wash_machine/201211/P020121130574743273239.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 4cce61f7f..57b452777 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -930,6 +930,15 @@ "rounds": 1, "type": "eq" }, + { "id": "p020121130574743273239", + "file": "pdfs/P020121130574743273239.pdf", + "md5": "271b65885d42d174cbc597ca89becb1a", + "rounds": 1, + "link": true, + "firstPage": 1, + "lastPage": 1, + "type": "eq" + }, { "id": "sfaa_japanese", "file": "pdfs/SFAA_Japanese.pdf", "md5": "b961bbc0d05bdd6d91041bca60ec8e8b",