diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-04 21:10:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-04 21:10:21 +0000 |
commit | 74728e861a713442320663646123dff99487108f (patch) | |
tree | 1087307121ffd1b2b2799b4e244e934a0495a625 /Master/texmf-dist/tex | |
parent | 4c7e9e5ca9cf88c9a2a11e287c02649ef2f4dd21 (diff) |
luatexja (4may19)
git-svn-id: svn://tug.org/texlive/trunk@50978 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
12 files changed, 147 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ajmacros.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ajmacros.sty index 8ca804f8a11..ca187cc900b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ajmacros.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ajmacros.sty @@ -2,7 +2,7 @@ % luatexja-ajmacros.sty % % Original: -% \ProvidesPackage{ajmacros}[2005/12/25 13:52 iNOUE Koich! <inoue@ma.ns.musashi-tech.ac.jp>] +% \ProvidesPackage{ajmacros}[2019/04/01 21:00 iNOUE Koich! <inoue@ma.ns.musashi-tech.ac.jp>] % @@ -347,7 +347,8 @@ \@ajligdef{#1}{\number\@tempcnta}\advance\@tempcnta\@ne \expandafter\@ajligaturedef\fi} \def\@aj@ligdef#1#2#3{\expandafter\xdef\csname ajLig\@ajmojifam#1\endcsname - {\noexpand\CID{\noexpand\unless\noexpand\ifnum\noexpand\ltjgetparameter\noexpand{direction\noexpand}=3 #2\noexpand\else#3\noexpand\fi}}} + {\unexpanded{\unless\ifnum\ltjgetparameter{direction}=3 }% + \noexpand\CID{#2}\noexpand\else\noexpand\CID{#3}\noexpand\fi}} \def\@aj@ligaturedef#1{\ifx\@nil#1\else \@aj@ligdef{#1}{\number\@tempcnta}{\number\@tempcntb}% \advance\@tempcnta\@ne\advance\@tempcntb\@ne @@ -441,6 +442,7 @@ \@ajligdef{より}{12181} \@ajligdef{升}{16194} \@ajligdef{コト}{16195} +\@aj@ligdef{令和}{23058}{23059}%AJ1-7 % \def\@ajmojifam{○} \@tempcnta7613 diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty index 76cfbcd91b9..082468b97bc 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty @@ -90,7 +90,7 @@ \protected\def\CID#1{\ifvmode\leavevmode\fi\ltj@tempcnta#1\relax\directlua{luatexja.otf.cid(\the\ltj@tempcnta)}\relax} %% \UTF compatible with the OTF package for pLaTeX -\protected\def\UTF#1{\ifvmode\leavevmode\fi\directlua{luatexja.otf.append_jglyph(0x#1)}} +\protected\def\UTF#1{\ifvmode\leavevmode\fi\directlua{luatexja.otf.utf(0x#1)}} %% Load ajmacros \ifltj@in@latex %<*LaTeX> diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua index a4c1d681cc5..bd798545f3f 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua @@ -18,6 +18,7 @@ end -- \kuten, \jis, \euc, \sjis, \ucs, \kansuji +local utfchar=utf.char local function to_kansuji(num) if not num then num=0; return elseif num<0 then @@ -25,7 +26,7 @@ local function to_kansuji(num) end local s = "" while num~=0 do - s = utf.char( + s = utfchar( ltjs.get_stack_table(luatexja.stack_table_index.KSJ + num%10, '', tex.getcount('ltj@@stack'))) .. s num=math.floor(num/10) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua index f8a7b578629..e901d438912 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua @@ -6,9 +6,9 @@ luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('charrange'); local ltjc = luatexja.charrange require("unicode") -local utflen = unicode.utf8.len -local utfbyte = unicode.utf8.byte -local utfchar = unicode.utf8.char +local utflen = utf.len +local utfbyte = utf.byte +local utfchar = utf.char local node_new = node.new local node_free = node.free local id_glyph = node.id('glyph') diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index dabed15d5e0..dcb5d6f80ec 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2019/02/11', + date = '2019/05/01', description = 'Loader for Japanese fonts', }) @@ -43,7 +43,7 @@ luatexbase.create_callback("luatexja.load_jfm", "data", function (ft, jn) return local jfm_file_name, jfm_var, jfm_ksp local defjfm_res -local jfm_dir, is_def_jfont, is_vert_enabled, auto_enable_vrt2 +local jfm_dir, is_def_jfont, vert_activated, auto_enable_vrt2 local function norm_val(a) if (not a) or (a==0.) then @@ -297,10 +297,10 @@ do end -- EXT - local utf8 = unicode.utf8 + local utfbyte = utf.byte function luatexja.jfont.jfontdefX(g, dir, csname) jfm_dir, is_def_jfont = dir, true - cstemp = csname:sub( (utf8.byte(csname,1,1) == tex.escapechar) and 2 or 1, -1) + cstemp = csname:sub( (utfbyte(csname,1,1) == tex.escapechar) and 2 or 1, -1) cstemp = cstemp:sub(1, ((cstemp:sub(-1,-1)==' ') and (cstemp:len()>=2)) and -2 or -1) global_flag = g and '\\global' or '' tex.sprint(cat_lp, '\\expandafter\\font\\csname ', @@ -338,7 +338,7 @@ do chars = sz.chars, char_type = sz.char_type, kanjiskip = sz.kanjiskip, xkanjiskip = sz.xkanjiskip, chars_cbcache = {}, - vert_activated = is_vert_enabled, + vert_activated = vert_activated, } local t = identifiers[fn] if auto_enable_vrt2 then @@ -434,11 +434,11 @@ do jfm_ksp = not (x=='-') end if jfm_dir == 'tate' then - is_vert_enabled = (not name:match('[:;]%-vert')) and (not name:match('[:;]%-vrt2')) + vert_activated = (not name:match('[:;]%-vert')) and (not name:match('[:;]%-vrt2')) auto_enable_vrt2 = (not name:match('[:;][+%-]?vert')) and (not name:match('[:;][+%-]?vrt2')) else - is_vert_enabled, auto_enable_vrt2 = nil, nil + vert_activated, auto_enable_vrt2 = nil, nil end return name end @@ -1093,16 +1093,32 @@ do [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44, [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, } - local function add_vform(coverage, vform, ft, add_vert) - if type(coverage)~='table' then return end - for i,v in pairs(vert_form_table) do - if not coverage[i] and ft.characters[v] then - vform[i] = v - end - end - if add_vert then -- vert feature が有効にならない場合 - for i,v in pairs(coverage) do vform[i] = vform[i] or v end - end + local vert_jpotf_table = {} + local function add_vform(coverage, vform, ft, add_vert, jpotf_vert) + if type(coverage)~='table' then return end + for i,v in pairs(vert_form_table) do + if not coverage[i] and ft.characters[v] then vform[i] = v end + end + if jpotf_vert then + for i,v in pairs(vert_jpotf_table) do + if ft.characters[v] then vform[i] = coverage[v] or vform[v] or v end + end + end + if add_vert then -- vert feature が有効にならない場合 + for i,v in pairs(coverage) do vform[i] = vform[i] or v end + end + end + + local utfbyte, utfsub = utf.byte, utf.sub + luatexja.jfont.register_vert_replace = function(t) + for i,v in pairs(t) do + local ic = (type(i)=='number') and i or + ((type(i)=='string') and utfbyte(utfsub(i,1,1)) or nil) + if ic then + vert_jpotf_table[ic] = (type(v)=='number') and v or + ((type(v)=='string') and utfbyte(utfsub(v,1,1)) or nil) + end + end end luatexbase.add_to_callback( @@ -1114,11 +1130,14 @@ luatexbase.add_to_callback( local add_vert = not (provides_feature(fnum, t.properties.script, t.properties.language, 'vert')) and not (provides_feature(fnum, t.properties.script, t.properties.language, 'vrt2')) + local jpotf_vert = t.shared.features.jpotf -- 現在の language, script で vert もvrt2 も有効にできない場合,強制的に vert 適用 for _,i in pairs(t.resources.sequences) do if i.order[1]== 'vert' and i.type == 'gsub_single' and i.steps then for _,j in pairs(i.steps) do - if type(j)=='table' then add_vform(j.coverage,vform, t, add_vert) end + if type(j)=='table' then + add_vform(j.coverage,vform, t, add_vert, jpotf_vert) + end end end end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua index d083026abbb..3b4d57e00c1 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua @@ -82,19 +82,49 @@ local function get_ucs_from_rmlgbm(c) elseif v<0xF0000 then -- 素直に Unicode にマップ可能 return v else -- privete use area - local w = ltjr_cidfont_data["Adobe-Japan1"].characters[v]. tounicode - -- must be non-nil! - local i = string.len(w) - if i==4 then -- UCS2 - return tonumber(w,16) - elseif i==8 then - i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16) - if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair - return (w-0xD800)*0x400 + (i-0xDC00) - else - return 0 + local r, aj = nil, ltjr_cidfont_data["Adobe-Japan1"] + -- 先に ltj_vert_table を見る + for i,w in pairs(aj.shared.ltj_vert_table) do + if w==v then r=i; break end + end + if not r then + -- なければ ToUnicode から引く + local w = aj.characters[v].tounicode -- must be non-nil! + local i = string.len(w) + if i==4 then -- UCS2 + r = tonumber(w,16) + elseif i==8 then + i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16) + if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair + r = (w-0xD800)*0x400 + (i-0xDC00) + else + r = 0 + end + end + end + if aj.shared.ltj_vert_table[r] then + -- CID が縦組用字形だった場合 + local curjfnt_num = tex_get_attr((ltjd_get_dir_count()==dir_tate) + and attr_curtfnt or attr_curjfnt) + local t = identifiers[curjfnt_num] + if t.resources.sequences then + for _,i in pairs(t.resources.sequences) do + if (i.order[1]=='vert' or i.order[1]=='vrt2') + and i.type == 'gsub_single' and i.steps then + for _,j in pairs(i.steps) do + if type(j)=='table' then + if type(j.coverage)=='table' then + for i,k in pairs(j.coverage) do + if i==r then return k end + end + end + end + end + end + end end end + return r end end @@ -108,10 +138,39 @@ local function append_jglyph(char) node_write(p) end +local utf +do + utf = function (ucs) + local char = ucs + if ltjd_get_dir_count()==dir_tate then + local curjfnt_num = tex_get_attr((ltjd_get_dir_count()==dir_tate) + and attr_curtfnt or attr_curjfnt) + local t = identifiers[curjfnt_num] + if t.resources.sequences then + for _,i in pairs(t.resources.sequences) do + if (i.order[1]=='vert' or i.order[1]=='vrt2') + and i.type == 'gsub_single' and i.steps then + for _,j in pairs(i.steps) do + if type(j)=='table' then + if type(j.coverage)=='table' then + for i,k in pairs(j.coverage) do + if i==char then return append_jglyph(k) end + end + end + end + end + end + end + end + end + return append_jglyph(char) + end +end + local cid do cid = function (key) - if key==0 then return append_jglyph(char) end + if key==0 then return append_jglyph(0) end local curjfnt_num = tex_get_attr((ltjd_get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) local curjfnt = identifiers[curjfnt_num] @@ -235,7 +294,7 @@ luatexja.otf = { append_jglyph = append_jglyph, enable_ivs = enable_ivs, -- 隠し機能: IVS disable_ivs = disable_ivs, -- 隠し機能: IVS - cid = cid, + cid = cid, utf = utf, } diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty index 1409c354d85..4277998e9d4 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty @@ -14,7 +14,7 @@ \ifltj@in@latex %<*LaTeX> \NeedsTeXFormat{LaTeX2e} \PackageWarning{ltj-plain}{Don't load this package directly; load luatexja.sty instead.} - \ProvidesPackage{ltj-plain}[2019/02/11] + \ProvidesPackage{ltj-plain}[2019/05/01] \fi %</LaTeX> %%------------------ @@ -100,6 +100,10 @@ \protected\def\@@end{% \directlua{luatexja.ext_cleanup()}\ltj@@orig@end} +\directlua{luatexja.jfont.register_vert_replace{ + [',']='、', ['.']='。', ['“']=0x301D, ['”']=0x301F, +}} + %%------------------ all done \ltj@plain@AtEnd \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua index abdece238ae..357560c4bf4 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua @@ -185,7 +185,7 @@ do for i = 0,kx[2] do cidm[i] = -1 end open_cmap_file(kx[1] .. "-V", increment, tonumber, entry) for i,v in pairs(tt) do - ttv[i] = cidmo[v.index] + ttv[i] = cidmo[v.index] -- "unicode" of vertical variant end -- tounicode エントリ diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 8fb24a80121..9756eadd62b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -400,7 +400,7 @@ local function get_attr_icflag(p) end local prefix, inner_depth - +local utfchar = utf.char local function debug_show_node_X(p,print_fn, limit) local k = prefix local s @@ -409,7 +409,7 @@ local function debug_show_node_X(p,print_fn, limit) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' ' if pt == 'glyph' then s = base .. ' ' .. - (p.char>=0xF0000 and string.format('(U+%X)', p.char) or utf.char(p.char)) .. ' ' + (p.char>=0xF0000 and string.format('(U+%X)', p.char) or utfchar(p.char)) .. ' ' .. tostring(p.font) .. ' (' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')x' .. print_scaled(p.width) if p.xoffset~=0 or p.yoffset~=0 then @@ -561,7 +561,7 @@ local function debug_show_node_X(p,print_fn, limit) end prefix = k; elseif pt=='math_char' then - s = base .. ' fam: ' .. p.fam .. ' , char = ' .. utf.char(p.char) + s = base .. ' fam: ' .. p.fam .. ' , char = ' .. utfchar(p.char) print_fn(s) elseif pt=='sub_box' or pt=='sub_mlist' then print_fn(base) diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty index 98927dc0569..a0a4d213bdc 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty @@ -41,7 +41,7 @@ \ProcessOptions\relax \fi %</LaTeX> %%%% VERSION -\def\LuaTeXjaversion{20190408.0} +\def\LuaTeXjaversion{20190504.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty index 21f6c4ce2ec..91827a3b7fd 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjdefs}[2019/02/11 Default font settings of LuaTeX-ja] +\ProvidesPackage{lltjdefs}[2019/05/01 Default font settings of LuaTeX-ja] \ifdefined\ltj@stdmcfont\else\def\ltj@stdmcfont{IPAExMincho}\fi \ifdefined\ltj@stdgtfont\else\def\ltj@stdgtfont{IPAExGothic}\fi @@ -120,6 +120,10 @@ \directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end} \protected\def\<{\ifvmode\leavevmode\fi\inhibitglue} +\directlua{luatexja.jfont.register_vert_replace{ + [',']='、', ['.']='。', ['“']=0x301D, ['”']=0x301F, +}} + % END OF FILE \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty index 32e4ef0b8ab..40f8c1e94e0 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty @@ -132,15 +132,19 @@ { \fontspec_visible_space_fallback: } } -\def\verb - { - \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\__fontspecsverb\@verb - } - +\AtBeginDocument{ + \cs_if_exist:NF \verbvisiblespace { + % >= LaTeX2e <2018-12-01> does not need the following patch + \def\verb + { + \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\__fontspecsverb\@verb + } + } +} \cs_set:Npn \emshape { \gtfamily \itshape } \cs_set:Npn \eminnershape { \mcfamily \upshape } |