OSDN Git Service

ltj-base.lua: use precompiled cache (.luc, .lub) if possible, as luaotfload
[luatex-ja/luatexja.git] / test / test19-ivs.tex
1 %#!lualatex
2 \documentclass{ltjsarticle}
3 \usepackage{luatexja-fontspec,luatexja-otf, luacode, booktabs,array}
4 \usepackage[scale=0.80]{geometry}
5
6 \begin{luacode}
7    local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
8    local ubyte = unicode.utf8.byte
9    local uchar = unicode.utf8.char
10    local sort = table.sort
11    function list_ivs(s)
12       local c = ubyte(s)
13       local pt = luatexja.otf.font_ivs_table[tex.attribute[attr_curjfnt]][c]
14       if pt then
15          local t = {}
16          for i,_ in pairs(pt) do t[1+#t]=i end
17          sort(t)
18          for _,i in ipairs(t) do 
19             if i<0xF0 then -- only IVS
20                tex.sprint('\\oalign{' .. s .. uchar(i+0xE0100)
21                           .. '\\crcr\\hss\\tiny' .. tostring(i) .. '\\hss\\crcr}') 
22             end
23          end
24       end
25    end
26 \end{luacode}
27
28 \def\MJI[#1]#2{#2\char\numexpr "E0100+#1\relax}%"
29 \def\IVSL#1{\directlua{list_ivs('#1')}}
30 \begin{document}
31 \jfontspec{ipamjm} % IPA MJ 明朝
32
33 例文はZRさんのブログ記事「ipamjmパッケージでアレしてみた」\footnote{%
34 \verb+http://d.hatena.ne.jp/zrbabbler/20131214/1387029624+}より引用.
35
36 \paragraph{標準状態では……}
37 \begin{quote}
38 \LARGE
39 渡邉󠄏さんとか   % { } の中は U+9089 U+E010F
40 渡𫟪󠄂さんとか。% { } の中は U+2B7EA U+E0102
41 \end{quote}
42
43 \paragraph{IVS処理コードをここで読み込んだ.}\ 
44 \directlua{luatexja.otf.enable_ivs()}
45
46 \begin{quote}
47 \LARGE
48 \MJI[15]{邉}\MJI[25]{邉}\MJI[27]{邉}\MJI[26]{邉}\MJI[26]{邉}\MJI[16]{邊}
49 \MJI[18]{邊}\MJI[2]{𫟪}\MJI[17]{邊}〓\\
50 \MJI[28]{邉}\MJI[29]{邉}\MJI[23]{邉}\MJI[15]{邊}\MJI[8]{邊}\MJI[20]{邉}
51 \MJI[24]{邉}\MJI[19]{邉}\MJI[18]{邉}\MJI[16]{邉}\\
52 \MJI[14]{邊}\MJI[10]{邊}\MJI[12]{邊}\MJI[11]{邊}\MJI[13]{邊}\MJI[9]{邊}
53 \MJI[0]{𫟪}\MJI[1]{𫟪}〓\MJI[21]{邉}
54 \end{quote}
55 「〓」はMJ番号を直接指定していたところなので,とりあえず無視している.
56 なぜか𫟪(U+2B7EA)のIVSが機能していないようだが,フォント側にその記述がない,ということ?
57
58 \begin{quote}
59 \LARGE
60 渡邉󠄏さんとか   % { } の中は U+9089 U+E010F
61 渡𫟪󠄂さんとか。% { } の中は U+2B7EA U+E0102
62 \end{quote}
63
64 \begin{center}
65 IPA MJ 明朝\par\medskip
66 \Large
67 \begin{tabular}{c>{\tt}ll}
68 \toprule
69 文字&Unicode&IVS\\
70 \midrule
71 邉&U+9089&\IVSL{邉}\\
72 邊&U+908A&\IVSL{邊}\\
73 𫟪&U+2B7EA&\IVSL{𫟪}\\
74 \bottomrule
75 \end{tabular}
76 \end{center}
77
78 \jfontspec{kozminpr6n-regular} % 小塚明朝 Pr6N R
79 \begin{center}
80 小塚明朝 Pr6N R\par\medskip
81 \Large
82 \begin{tabular}{c>{\tt}ll}
83 \toprule
84 文字&Unicode&IVS\\
85 \midrule
86 邉&U+9089&\IVSL{邉}\\
87 邊&U+908A&\IVSL{邊}\\
88 𫟪&U+2B7EA&\IVSL{𫟪}\\
89 \bottomrule
90 \end{tabular}
91 \end{center}
92
93
94 \jfontspec{hanamina} % 花園明朝A
95 \begin{center}
96 花園明朝A\par\medskip
97 \Large
98 \begin{tabular}{c>{\tt}ll}
99 \toprule
100 文字&Unicode&IVS\\
101 \midrule
102 邉&U+9089&\IVSL{邉}\\
103 邊&U+908A&\IVSL{邊}\\
104 𫟪&U+2B7EA&\IVSL{𫟪}\\
105 \bottomrule
106 \end{tabular}
107 \end{center}
108
109 \newpage
110 \def\TEST{%
111   奈良県葛󠄀城市と東京都葛󠄁飾区.%
112   江戸川区葛西はどっち?
113 }
114
115
116 \begin{quote}
117  \Large
118  {\jfontspec{KozMinPr6N-Regular}\TEST}\\
119  {\jfontspec[CJKShape=JIS1978]{KozMinPr6N-Regular}\TEST}\\
120  {\jfontspec[CJKShape=JIS1990]{KozMinPr6N-Regular}\TEST}
121 \end{quote}
122 \end{document}