OSDN Git Service

Stopped using old tokenlib in ltj-jfont.lua
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 4 May 2015 01:35:23 +0000 (10:35 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 4 May 2015 01:35:23 +0000 (10:35 +0900)
 TODO: \expandafter\jfont\csname\endcsname= ... (the argument is null cs)

src/ltj-jfmglue.lua
src/ltj-jfont.lua
src/ltj-plain.sty
src/luatexja-core.sty

index 8971a77..e5fcd0c 100644 (file)
@@ -3,7 +3,7 @@
 --
 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)
@@ -382,7 +382,6 @@ local function calc_np_aux_glyph_common(lp)
         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
index 76ca9ff..cda9d1d 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2015/02/08',
+  date = '2015/05/03',
   description = 'Loader for Japanese fonts',
 })
 module('luatexja.jfont', package.seeall)
@@ -38,7 +38,7 @@ local id_glue_spec = node.id('glue_spec')
 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
 ------------------------------------------------------------------------
@@ -242,12 +242,14 @@ do
    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)
@@ -263,7 +265,8 @@ do
                            "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
@@ -282,7 +285,7 @@ do
       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
index 3d2095c..62cfcf7 100644 (file)
@@ -51,7 +51,7 @@
 
 \def\mc{\tenmin\tentmin}
 \def\gt{\tengt\tentgt}
-\mc\tentmin
+\mc
 
 \directlua{
   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
index 753a840..dd20eee 100644 (file)
@@ -65,7 +65,7 @@
   \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