リビジョン | f8fad384d02f7f79bf591e967a9476d897bc9a15 (tree) |
---|---|
日時 | 2019-05-03 06:22:12 |
作者 | Hironori Kitagawa <h_kitagawa2001@yaho...> |
コミッター | Hironori Kitagawa |
\CID for non-AJ1 font
@@ -82,21 +82,27 @@ local function get_ucs_from_rmlgbm(c) | ||
82 | 82 | elseif v<0xF0000 then -- 素直に Unicode にマップ可能 |
83 | 83 | return v |
84 | 84 | else -- privete use area |
85 | - local w = ltjr_cidfont_data["Adobe-Japan1"].characters[v]. tounicode | |
86 | - -- must be non-nil! | |
87 | - local i = string.len(w) | |
88 | - local r | |
89 | - if i==4 then -- UCS2 | |
90 | - r = tonumber(w,16) | |
91 | - elseif i==8 then | |
92 | - i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16) | |
93 | - if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair | |
94 | - r = (w-0xD800)*0x400 + (i-0xDC00) | |
95 | - else | |
96 | - r = 0 | |
85 | + local r, aj = nil, ltjr_cidfont_data["Adobe-Japan1"] | |
86 | + -- 先に ltj_vert_table を見る | |
87 | + for i,w in pairs(aj.shared.ltj_vert_table) do | |
88 | + if w==v then r=i; break end | |
89 | + end | |
90 | + if not r then | |
91 | + -- なければ ToUnicode から引く | |
92 | + local w = aj.characters[v].tounicode -- must be non-nil! | |
93 | + local i = string.len(w) | |
94 | + if i==4 then -- UCS2 | |
95 | + r = tonumber(w,16) | |
96 | + elseif i==8 then | |
97 | + i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16) | |
98 | + if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair | |
99 | + r = (w-0xD800)*0x400 + (i-0xDC00) | |
100 | + else | |
101 | + r = 0 | |
102 | + end | |
97 | 103 | end |
98 | 104 | end |
99 | - if ltjr_cidfont_data["Adobe-Japan1"].shared.ltj_vert_table[r] then | |
105 | + if aj.shared.ltj_vert_table[r] then | |
100 | 106 | -- CID が縦組用字形だった場合 |
101 | 107 | local curjfnt_num = tex_get_attr((ltjd_get_dir_count()==dir_tate) |
102 | 108 | and attr_curtfnt or attr_curjfnt) |