2 \documentclass{ltjsarticle}
3 \usepackage{luatexja-fontspec,luatexja-otf, luacode, booktabs,array,xcolor}
4 \usepackage[scale=0.80]{geometry}
6 \setsansjfont{KozGoPr6N-Regular}
10 local identifiers = fonts.hashes.identifiers
11 local fallback_color = 'red' -- IVS がないときは,この色で既定文字を出力
12 local list_color = 'blue!50!black' -- リスト表示の色
14 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
15 local ubyte = unicode.utf8.byte
16 local uchar = unicode.utf8.char
17 local sort = table.sort
20 local pt = identifiers[tex.getattribute(attr_curjfnt)].resources
21 pt = pt and pt.variants
24 for i,v in pairs(pt) do
25 if v[c] then t[#t+1]={i,v[c]} end
27 sort(t, function(a,b) return a[1]<b[1] end)
28 tex.sprint('\\textcolor{' .. list_color .. '}{')
29 for _,i in ipairs(t) do
30 if i[1]>=0xE0100 then -- only IVS
31 tex.sprint('\\oalign{' .. s .. uchar(i[1])
32 .. '\\crcr\\hss\\tiny' .. tostring(i[1]-0xE0100) .. '\\hss\\crcr}')
37 tex.sprint('\\textcolor{' .. fallback_color .. '}{' .. s .. '}')
44 %%%%% \IVS[<selector number>]{<character>}
45 %%%%% or \IVS<selector number>{<character>}
46 %%%%% (<selector number>: 0--239, or `?')
47 \def\ltj@ivs@out#1#2{#2\char\numexpr "E0100+#1\relax} % IVS"
48 \def\ltj@ivs@list?#1{\directlua{list_ivs('#1')}}
49 \def\ltj@ivs@grab@num{\expandafter\expandafter\expandafter\ltj@ivs@out\ltj@grab@num}
50 \def\ltj@ivs@nobracket{\@ifnextchar?{\ltj@ivs@list}{\ltj@ivs@grab@num}}
51 \def\ltj@ivs@bracket[#1]{\ltj@ivs@nobracket#1}
52 \def\IVS{\@ifnextchar[{\ltj@ivs@bracket}{\ltj@ivs@nobracket}}
57 \jfontspec{ipamjm} % IPAmj明朝
59 例文はZRさんのブログ記事「ipamjmパッケージでアレしてみた」\footnote{%
60 \verb+http://d.hatena.ne.jp/zrbabbler/20131214/1387029624+}より引用.
64 渡邉󠄏さんとか% { } の中は U+9089 U+E010F
65 渡𫟪󠄂さんとか。% { } の中は U+2B7EA U+E0102
71 \MJI15{邉}\MJI25{邉}\MJI27{邉}\MJI26{邉}\MJI26{邉}\MJI16{邊}
72 \MJI18{邊}\textcolor{blue}{\MJI2{𫟪}}\MJI17{邊}〓\\
73 \MJI28{邉}\MJI29{邉}\MJI23{邉}\MJI15{邊}\MJI8{邊}\MJI20{邉}
74 \MJI24{邉}\MJI19{邉}\MJI18{邉}\MJI16{邉}\\
75 \MJI14{邊}\MJI10{邊}\MJI12{邊}\MJI11{邊}\MJI13{邊}\MJI9{邊}
76 \textcolor{blue}{\MJI0{𫟪}}\textcolor{blue}{\MJI1{𫟪}}〓\MJI21{邉}
78 MJ番号を直接指定していたところは,このソース中では無視して下駄「〓」にした.
83 渡邉󠄏さんとか% { } の中は U+9089 U+E010F
84 渡𫟪󠄂さんとか。% { } の中は U+2B7EA U+E0102
93 \paragraph{IVSとopentype featureの干渉テスト}
97 {\jfontspec{KozMinPr6N-Regular}\TEST}\\
98 {\jfontspec[CJKShape=JIS1978]{KozMinPr6N-Regular}\TEST}\\
99 {\jfontspec[CJKShape=JIS1990]{KozMinPr6N-Regular}\TEST}
108 \begin{tabular}{c>{\tt}ll}
122 \TABLE{IPAmj明朝}{ipamjm}
123 \TABLE{小塚明朝 Pr6N R}{kozminpr6n-regular}
124 \TABLE{Source Han Serif Regular}{Source\space Han\space Serif\space Regular}
126 \begin{lstlisting}[basicstyle=\tt, columns=fixed, basewidth=.5em]