--
luatexbase.provides_module({
name = 'luatexja.jfmglue',
- date = '2015/02/07',
+ date = '2015/05/03',
description = 'Insertion process of JFM glues and kanjiskip',
})
module('luatexja.jfmglue', package.seeall)
local npn = Np.nuc
Np.last_char = npn
if r then
- print(getfield(r, 'depth'))
local nf, nc = getfont(npn), getchar(npn)
local ct = (font.getfont(nf) or font.fonts[nf] ).characters[nc]
if not ct then -- variation selector
--
luatexbase.provides_module({
name = 'luatexja.jfont',
- date = '2015/02/08',
+ date = '2015/05/03',
description = 'Loader for Japanese fonts',
})
module('luatexja.jfont', package.seeall)
local id_glue = node.id('glue')
local cat_lp = luatexbase.catcodetables['latex-package']
local FROM_JFM = luatexja.icflag_table.FROM_JFM
-
+local tokenlib = luatexja.token
------------------------------------------------------------------------
-- LOADING JFM
------------------------------------------------------------------------
end
-- EXT
- function jfontdefX(g, dir)
+ local utf8 = unicode.utf8
+ function jfontdefX(g, dir, csname)
jfm_dir, is_def_jfont = dir, true
- local t = token.get_next()
- cstemp=token.csname_name(t)
+ cstemp = csname:sub( (utf8.byte(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 ', cstemp, '\\endcsname')
+ tex.sprint(cat_lp, '\\expandafter\\font\\csname ',
+ (cstemp==' ') and '\\space' or cstemp, '\\endcsname')
end
luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end)
"bad JFM `" .. jfm_file_name .. "'",
'The JFM file you specified is not valid JFM file.\n'..
'So defining Japanese font is cancelled.')
- tex.sprint(cat_lp, global_flag, '\\expandafter\\let\\csname ', cstemp,
+ tex.sprint(cat_lp, global_flag, '\\expandafter\\let\\csname ',
+ (cstemp==' ') and '\\space' or cstemp,
'\\endcsname=\\relax')
return
end
fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn)
font_metric_table[fn]=fmtable
tex.sprint(cat_lp, global_flag, '\\protected\\expandafter\\def\\csname ',
- cstemp , '\\endcsname{\\ltj@cur'..
+ (cstemp==' ') and '\\space' or cstemp, '\\endcsname{\\ltj@cur'..
(jfm_dir == 'yoko' and 'j' or 't') .. 'fnt', fn, '\\relax}')
end
end
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-core}[2015/02/22 Core of LuaTeX-ja]
+ \ProvidesPackage{luatexja-core}[2015/05/03 Core of LuaTeX-ja]
\fi %</LaTeX>
%% Load prerequisite packages.
\fi %</LaTeX>
%%%%%%%% \asluastring
-\def\asluastring#1{'\luaescapestring{\detokenize{#1}}'}
+\def\asluastring#1{'\luatexluaescapestring{\detokenize{#1}}'}
%%%%%%%% Redefine \/
\protected\def\/{\relax\directlua{luatexja.jfont.append_italic()}}
%%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont
-\protected\def\jfont{%
- \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko')}}
-\protected\def\globaljfont{%
- \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko')}}
+\protected\def\jfont#1{%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko','\luatexluaescapestring{\noexpand#1}')}}
+\protected\def\globaljfont#1{%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko','\luatexluaescapestring{\noexpand#1}')}}
\def\ltj@@jfont{\directlua{luatexja.jfont.jfontdefY()}}
%%%%%%%% \tfont\CS={...:...;jfm=metric;...}, \globaltfont
-\protected\def\tfont{%
- \afterassignment\ltj@@tfont\directlua{luatexja.jfont.jfontdefX(false, 'tate')}}
-\protected\def\globaltfont{%
- \afterassignment\ltj@@tfont\directlua{luatexja.jfont.jfontdefX(true, 'tate')}}
+\protected\def\tfont#1{%
+ \afterassignment\ltj@@tfont\directlua{luatexja.jfont.jfontdefX(false, 'tate','\luatexluaescapestring{\noexpand#1}')}}
+\protected\def\globaltfont#1{%
+ \afterassignment\ltj@@tfont\directlua{luatexja.jfont.jfontdefX(true, 'tate','\luatexluaescapestring{\noexpand#1}')}}
\def\ltj@@tfont{\directlua{luatexja.jfont.jfontdefY()}}
%%%%%%%% \zw, \zh