Add Hankaku-Latin cid to Unicode mappings

This commit is contained in:
vyv03354 2013-01-30 02:46:17 +09:00
parent 7bd8887860
commit a8aed74431
4 changed files with 31 additions and 10 deletions

View File

@ -28,7 +28,8 @@ var CIDToUnicodeMaps = {
174, 0, 0, {f: 2, c: 178}, 181, 185, {f: 3, c: 188}, {f: 6, c: 192}, 174, 0, 0, {f: 2, c: 178}, 181, 185, {f: 3, c: 188}, {f: 6, c: 192},
{f: 16, c: 199}, 0, {f: 6, c: 217}, {f: 6, c: 224}, {f: 16, c: 231}, 0, {f: 16, c: 199}, 0, {f: 6, c: 217}, {f: 6, c: 224}, {f: 16, c: 231}, 0,
{f: 7, c: 249}, 352, 376, 381, [773, 8254], 353, 8482, 382, 0, 8194, {f: 7, c: 249}, 352, 376, 381, [773, 8254], 353, 8482, 382, 0, 8194,
{s: 91}, 65512, {s: 3}, {f: 63, c: 65377}, {s: 243}, [8195, 12288], {f: 59, c: 33}, 165, {f: 31, c: 93}, 65512, {f: 2, c: 125}, 0,
{f: 63, c: 65377}, {s: 243}, [8195, 12288],
{f: 2, c: 12289}, 65292, 65294, 12539, {f: 2, c: 65306}, 65311, 65281, {f: 2, c: 12289}, 65292, 65294, 12539, {f: 2, c: 65306}, 65311, 65281,
{f: 2, c: 12443}, 180, 65344, 168, 65342, 65507, 65343, {f: 2, c: 12541}, {f: 2, c: 12443}, 180, 65344, 168, 65342, 65507, 65343, {f: 2, c: 12541},
{f: 2, c: 12445}, 12291, 20189, {f: 3, c: 12293}, 12540, 8213, 8208, 65295, {f: 2, c: 12445}, 12291, 20189, {f: 3, c: 12293}, 12540, 8213, 8208, 65295,
@ -780,9 +781,9 @@ var CIDToUnicodeMaps = {
37854, 37880, 37937, 37957, 37960, 38290, 0, 64041, 38557, 38575, 38707, 37854, 37880, 37937, 37957, 37960, 38290, 0, 64041, 38557, 38575, 38707,
38715, 38723, 38733, 38735, [12205, 38737], 0, 38999, 39013, 38715, 38723, 38733, 38735, [12205, 38737], 0, 38999, 39013,
{f: 2, c: 64042}, 39207, 64044, 39326, 39502, 39641, 39644, 39797, 39794, {f: 2, c: 64042}, 39207, 64044, 39326, 39502, 39641, 39644, 39797, 39794,
39823, 39857, 39867, 39936, 40304, 40299, 64045, 40473, 40657, {s: 636}, 39823, 39857, 39867, 39936, 40304, 40299, 64045, 40473, 40657, 0, 92,
8364, 8486, 0, 0, 64256, {f: 2, c: 64259}, 257, 299, 363, 275, 333, 256, {s: 634}, 8364, 8486, 0, 0, 64256, {f: 2, c: 64259}, 257, 299, 363, 275,
298, 362, 274, 332, {f: 4, c: 8539}, {f: 2, c: 8531}, 8304, 333, 256, 298, 362, 274, 332, {f: 4, c: 8539}, {f: 2, c: 8531}, 8304,
{f: 6, c: 8308}, {f: 10, c: 8320}, 461, 282, 0, 7868, 463, 0, 296, 465, 0, {f: 6, c: 8308}, {f: 10, c: 8320}, 461, 282, 0, 7868, 463, 0, 296, 465, 0,
467, 366, 360, 462, 283, 0, 7869, 464, 0, 297, 466, 0, 468, 367, 361, 593, 467, 366, 360, 462, 283, 0, 7869, 464, 0, 297, 466, 0, 468, 367, 361, 593,
8049, 8048, 509, 0, 596, 0, 0, 601, 0, 0, 602, 0, 0, 603, 8051, 8050, 0, 8049, 8048, 509, 0, 596, 0, 0, 601, 0, 0, 602, 0, 0, 603, 8051, 8050, 0,

View File

@ -413,6 +413,19 @@ var CMapConverterList = {
'90msp-RKSJ-V': sjisToUnicode '90msp-RKSJ-V': sjisToUnicode
}; };
// CMaps using Hankaku (Halfwidth) Latin glyphs instead of proportional one.
// We need to distinguish them to get correct widths from CIDFont dicts.
var HalfwidthCMaps = {
'H': true,
'V': true,
'EUC-H': true,
'EUC-V': true,
'90ms-RKSJ-H': true,
'90ms-RKSJ-V': true,
'UniJIS-UCS2-HW-H': true,
'UniJIS-UCS2-HW-V': true
};
var decodeBytes; var decodeBytes;
if (typeof TextDecoder !== 'undefined') { if (typeof TextDecoder !== 'undefined') {
decodeBytes = function(bytes, encoding) { decodeBytes = function(bytes, encoding) {
@ -4141,14 +4154,18 @@ var Font = (function FontClosure() {
if (!cidToUnicode) if (!cidToUnicode)
return; // identity encoding return; // identity encoding
var cidEncoding = properties.cidEncoding;
var overwrite = HalfwidthCMaps[cidEncoding];
var cid = 1, i, j, k, ii; var cid = 1, i, j, k, ii;
for (i = 0, ii = cidToUnicode.length; i < ii; ++i) { for (i = 0, ii = cidToUnicode.length; i < ii; ++i) {
var unicode = cidToUnicode[i]; var unicode = cidToUnicode[i];
if (isArray(unicode)) { if (isArray(unicode)) {
var length = unicode.length; var length = unicode.length;
for (j = 0; j < length; j++) { for (j = 0; j < length; j++) {
cidToUnicodeMap[cid] = unicode[j]; cidToUnicodeMap[cid] = k = unicode[j];
unicodeToCIDMap[unicode[j]] = cid; if (!unicodeToCIDMap[k] || overwrite) {
unicodeToCIDMap[k] = cid;
}
} }
cid++; cid++;
} else if (typeof unicode === 'object') { } else if (typeof unicode === 'object') {
@ -4157,7 +4174,9 @@ var Font = (function FontClosure() {
k = unicode.c; k = unicode.c;
for (j = 0; j < fillLength; ++j) { for (j = 0; j < fillLength; ++j) {
cidToUnicodeMap[cid] = k; cidToUnicodeMap[cid] = k;
unicodeToCIDMap[k] = cid; if (!unicodeToCIDMap[k] || overwrite) {
unicodeToCIDMap[k] = cid;
}
cid++; cid++;
k++; k++;
} }
@ -4165,13 +4184,14 @@ var Font = (function FontClosure() {
cid += unicode.s; cid += unicode.s;
} else if (unicode) { } else if (unicode) {
cidToUnicodeMap[cid] = unicode; cidToUnicodeMap[cid] = unicode;
unicodeToCIDMap[unicode] = cid; if (!unicodeToCIDMap[unicode] || overwrite) {
unicodeToCIDMap[unicode] = cid;
}
cid++; cid++;
} else } else
cid++; cid++;
} }
var cidEncoding = properties.cidEncoding;
if (!cidEncoding) { if (!cidEncoding) {
return; return;
} }

Binary file not shown.

View File

@ -833,7 +833,7 @@
}, },
{ "id": "noembed-identity-2", { "id": "noembed-identity-2",
"file": "pdfs/noembed-identity-2.pdf", "file": "pdfs/noembed-identity-2.pdf",
"md5": "5549571a910814a9c53a1761b27fd028", "md5": "13b7d9ab9579d45c10bc8d499d087f21",
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },