OSDN Git Service

Renamed Lua files and manuals (please do more tests).
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 20 Apr 2012 11:35:57 +0000 (20:35 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 20 Apr 2012 11:35:57 +0000 (20:35 +0900)
51 files changed:
doc/luatexja-en.pdf [moved from doc/man-en.pdf with 76% similarity]
doc/luatexja-ja.pdf [moved from doc/man-ja.pdf with 76% similarity]
doc/luatexja-zh.pdf [moved from doc/manual-zh.pdf with 97% similarity]
doc/luatexja-zh.tex [moved from doc/manual-zh.tex with 100% similarity]
doc/luatexja.dtx [moved from doc/manual.dtx with 100% similarity]
doc/luatexja.ins [new file with mode: 0644]
doc/manual.ins [deleted file]
src/addons/luatexja-otf.sty
src/jfm-banjiao.lua [moved from test/zh/jfm-banjiao.lua with 100% similarity]
src/jfm-kaiming.lua [moved from test/zh/jfm-kaiming.lua with 100% similarity]
src/jfm-quanjiao.lua [moved from test/zh/jfm-quanjiao.lua with 100% similarity]
src/ltj-base.lua [moved from src/luatexja/base.lua with 100% similarity]
src/ltj-charrange.lua [moved from src/luatexja/charrange.lua with 100% similarity]
src/ltj-cid-adobe-cns1.lua [moved from src/luatexja-cid-std-adobe-cns1.lua with 100% similarity, mode: 0644]
src/ltj-cid-adobe-gb1.lua [moved from src/luatexja-cid-std-adobe-gb1.lua with 100% similarity, mode: 0644]
src/ltj-cid-adobe-japan1.lua [moved from src/luatexja-cid-std-adobe-japan1.lua with 100% similarity]
src/ltj-cid-adobe-korea1.lua [moved from src/luatexja-cid-std-adobe-korea1.lua with 100% similarity, mode: 0644]
src/ltj-compat.lua [moved from src/luatexja/compat.lua with 100% similarity]
src/ltj-debug.lua [moved from src/luatexja/debug.lua with 100% similarity]
src/ltj-infomute.lua [moved from src/luatexja/infomute.lua with 100% similarity]
src/ltj-inputbuf.lua [moved from src/luatexja/inputbuf.lua with 100% similarity]
src/ltj-jfmglue.lua [moved from src/luatexja/jfmglue.lua with 100% similarity]
src/ltj-jfont.lua [moved from src/luatexja/jfont.lua with 96% similarity]
src/ltj-jisx0208.lua [moved from src/luatexja/jisx0208.lua with 100% similarity]
src/ltj-math.lua [moved from src/luatexja/math.lua with 100% similarity]
src/ltj-otf.lua [moved from src/luatexja/otf.lua with 100% similarity]
src/ltj-pretreat.lua [moved from src/luatexja/pretreat.lua with 100% similarity]
src/ltj-rmlgbm.lua [moved from src/luatexja/rmlgbm.lua with 56% similarity]
src/ltj-setwidth.lua [moved from src/luatexja/setwidth.lua with 100% similarity]
src/ltj-stack.lua [moved from src/luatexja/stack.lua with 100% similarity]
src/ltj-tangle.lua [moved from src/luatexja/tangle.lua with 100% similarity]
src/luatexja-base.sty
src/luatexja-compat.sty
src/luatexja-core.sty
src/luatexja.lua [moved from src/luatexja-core.lua with 86% similarity]
test/test01-noembed.pdf
test/test01.pdf
test/test02-latex.pdf
test/test02-latex.tex
test/test03-after.pdf
test/test03-after.tex
test/test04-jfm.pdf
test/test04-jfm.tex
test/test06-offset.pdf
test/test06-offset.tex
test/test07-math-unicode.pdf
test/test07-math.pdf
test/test08-tombow.pdf
test/test09-fontspec.pdf
test/test10-otf.pdf
test/zh/cid-test.pdf

similarity index 76%
rename from doc/man-en.pdf
rename to doc/luatexja-en.pdf
index faf3cc6..772e88a 100644 (file)
Binary files a/doc/man-en.pdf and b/doc/luatexja-en.pdf differ
similarity index 76%
rename from doc/man-ja.pdf
rename to doc/luatexja-ja.pdf
index 628ed0d..e4467be 100644 (file)
Binary files a/doc/man-ja.pdf and b/doc/luatexja-ja.pdf differ
similarity index 97%
rename from doc/manual-zh.pdf
rename to doc/luatexja-zh.pdf
index bab6252..3b3b8a8 100644 (file)
Binary files a/doc/manual-zh.pdf and b/doc/luatexja-zh.pdf differ
similarity index 100%
rename from doc/manual-zh.tex
rename to doc/luatexja-zh.tex
similarity index 100%
rename from doc/manual.dtx
rename to doc/luatexja.dtx
diff --git a/doc/luatexja.ins b/doc/luatexja.ins
new file mode 100644 (file)
index 0000000..adfc4f2
--- /dev/null
@@ -0,0 +1,8 @@
+%#! lualatex -shell-escape
+\input docstrip.tex
+\askforoverwritefalse
+\generate{\file{luatexja-ja.tex}{\from{luatexja.dtx}{ja}}
+          \file{luatexja-en.tex}{\from{luatexja.dtx}{en}}}
+\immediate\write18{lualatex luatexja-ja}
+\immediate\write18{lualatex luatexja-en}
+\endbatchfile
diff --git a/doc/manual.ins b/doc/manual.ins
deleted file mode 100644 (file)
index 6793df6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-%#! lualatex -shell-escape
-\input docstrip.tex
-\askforoverwritefalse
-\generate{\file{man-ja.tex}{\from{manual.dtx}{ja}}
-          \file{man-en.tex}{\from{manual.dtx}{en}}}
-\immediate\write18{lualatex man-ja}
-\immediate\write18{lualatex man-en}
-\endbatchfile
index d2c469c..5327a99 100644 (file)
   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
     \csname iftrue\endcsname
   \NeedsTeXFormat{LaTeX2e}
-  \ProvidesPackage{luatexja-otf}[2011/09/09 v0.1]
+  \ProvidesPackage{luatexja-otf}[2012/4/20 v0.2]
 \fi                             %</LaTeX>
 
 % Load core module if not yet.
 \ifx\luatexjacoreLoaded\@undefined
   \ifltj@in@latex                 %<*LaTeX>
-    \RequirePackage{luatexja-core}[2011/04/01]
+    \RequirePackage{luatexja-core}[2012/04/20]
   \else                           %<*!LaTeX>
     \input luatexja-core.sty %
   \fi                             %</LaTeX>
@@ -83,7 +83,7 @@
 
 %%------------------
 %! Main part of luatexja-otf
-\RequireLuaModule{luatexja.otf}
+\directlua{luatexja.load_module('otf')}
 
 \newcount\ltj@tempcnta
 
similarity index 100%
rename from test/zh/jfm-banjiao.lua
rename to src/jfm-banjiao.lua
similarity index 100%
rename from test/zh/jfm-kaiming.lua
rename to src/jfm-kaiming.lua
similarity index 100%
rename from src/luatexja/base.lua
rename to src/ltj-base.lua
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from src/luatexja-cid-std-adobe-cns1.lua
rename to src/ltj-cid-adobe-cns1.lua
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from src/luatexja-cid-std-adobe-gb1.lua
rename to src/ltj-cid-adobe-gb1.lua
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from src/luatexja-cid-std-adobe-korea1.lua
rename to src/ltj-cid-adobe-korea1.lua
similarity index 100%
rename from src/luatexja/compat.lua
rename to src/ltj-compat.lua
similarity index 100%
rename from src/luatexja/debug.lua
rename to src/ltj-debug.lua
similarity index 100%
rename from src/luatexja/jfmglue.lua
rename to src/ltj-jfmglue.lua
similarity index 96%
rename from src/luatexja/jfont.lua
rename to src/ltj-jfont.lua
index aff5b96..528a474 100644 (file)
@@ -152,7 +152,7 @@ local function load_jfont_metric()
    for j,v in ipairs(metrics) do 
       if v.name==jfm_file_name then return j end
    end
-   ltj.loadlua('jfm-' .. jfm_file_name .. '.lua')
+   luatexja.load_lua('jfm-' .. jfm_file_name .. '.lua')
    if defjfm_res then
       defjfm_res.name = jfm_file_name
       table.insert(metrics, defjfm_res)
@@ -172,7 +172,7 @@ local cstemp
 function jfontdefX(g)
   local t = token.get_next()
   cstemp=token.csname_name(t)
-  if g then ltj.is_global = '\\global' else ltj.is_global = '' end
+  if g then luatexja.is_global = '\\global' else luatexja.is_global = '' end
   tex.sprint(cat_lp, '\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname')
 end
 
@@ -188,7 +188,7 @@ function jfontdefY() -- for horizontal font
                         "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, ltj.is_global .. '\\expandafter\\let\\csname ' ..cstemp 
+      tex.sprint(cat_lp, luatexja.is_global .. '\\expandafter\\let\\csname ' ..cstemp 
              .. '\\endcsname=\\relax')
      return 
    end
@@ -196,7 +196,7 @@ function jfontdefY() -- for horizontal font
    local fmtable = { jfm = j, size = f.size, var = jfm_var }
    fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn)
    font_metric_table[fn]=fmtable
-   tex.sprint(cat_lp, ltj.is_global .. '\\protected\\expandafter\\def\\csname ' 
+   tex.sprint(cat_lp, luatexja.is_global .. '\\protected\\expandafter\\def\\csname ' 
           .. cstemp  .. '\\endcsname{\\ltj@curjfnt=' .. fn .. '\\relax}')
 end
 
similarity index 100%
rename from src/luatexja/math.lua
rename to src/ltj-math.lua
similarity index 100%
rename from src/luatexja/otf.lua
rename to src/ltj-otf.lua
similarity index 56%
rename from src/luatexja/rmlgbm.lua
rename to src/ltj-rmlgbm.lua
index b8363c0..37b07a3 100644 (file)
@@ -21,122 +21,27 @@ local path           = {
     localdir  = file.join(kpse.expand_var("$TEXMFVAR"), aux_dir),
     systemdir = file.join(kpse.expand_var("$TEXMFSYSVAR"), aux_dir),
 }
-local cid_replace = {
-   ["Adobe-Japan1"] = "UniJISX0213-UTF32",
-   ["Adobe-Korea1"] = "UniKS-UTF32",
-   ["Adobe-GB1"]    = "UniGB-UTF32",
-   ["Adobe-CNS1"]   = "UniCNS-UTF32",
-}
-
--- reading CID maps
-local line, fh, tt
-
-local function load_bf_char()
-   local cid, ucs, ucsa
-   line = fh:read("*l")
-   while line do
-      if line == "endcidchar" then 
-        line = fh:read("*l"); return
-      else -- WMA l is in the form "<%x+>%s%d+"
-        ucs, cid = string.match(line, "<(%x+)>%s+(%d+)")
-        cid = tonumber(cid, 10); ucs = tonumber(ucs, 16); 
-        if not tt[ucs]  then 
-           tt[ucs] = { index = cid, width = 655360 } 
-        end
-      end
-      line = fh:read("*l")
-   end
-end
-
-local function load_bf_range()
-   local bucs, eucs, cid
-   line = fh:read("*l")
-   while line do
-      if line == "endcidrange" then 
-        line = fh:read("*l"); return
-      else -- WMA l is in the form "<%x+>%s+<%x+>"
-        bucs, eucs, cid = string.match(line, "<(%x+)>%s+<(%x+)>%s+(%d+)")
-        cid = tonumber(cid, 10); bucs = tonumber(bucs, 16); eucs = tonumber(eucs, 16);
-        for ucs = bucs, eucs do
-           if not tt[ucs]  then 
-              tt[ucs] = { index = cid, width = 655360 }
-           end
-           cid = cid+1
-        end
-      end
-      line = fh:read("*l")
-   end
-end
-
-local function make_cid_font()
-   cidfont_data[cid_name] = {
-      cidinfo = { ordering=cid_order, registry=cid_reg, supplement=cid_supp },
-      encodingbytes = 2, extend=1000, format = 'opentype',
-      direction = 0, characters = {}, parameters = {}, embedding = "no", cache = "yes", 
-      ascender = 0, descender = 0, factor = 0, hfactor = 0, vfactor = 0, 
-   }
-   tt = {}
-
-   -- Open
-   -- TODO: vertical fonts?
-   fh = io.open(kpse.find_file(cid_replace[cid_name] .. "-H", 'cmap files'), "r")
-   line = fh:read("*l")
-   while line do
-      if string.find(line, "%x+%s+begincidchar") then
-        load_bf_char()
-      elseif string.find(line, "%x+%s+begincidrange") then
-        load_bf_range()
-      else
-        line = fh:read("*l")
-      end
-   end
-   fh:close();  cidfont_data[cid_name].characters = tt
-   cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
-
-   -- Save
-   local savepath  = path.localdir
-   if not lfs.isdir(savepath) then
-      dir.mkdirs(savepath)
-   end
-   savepath = file.join(savepath, "luatexja-cid-auto-" 
-                       .. string.lower(cid_name)  .. ".lua")
-   if file.iswritable(savepath) then
-      table.tofile(savepath, cidfont_data[cid_name],'return', false, true, false )
-   else 
-      ltjb.package_warning('luatexja', 
-                          'failed to save informations of non-embedded 2-byte fonts', '')
-   end
-end
 
 -- 
 local function read_cid_font()
-   local names = {
-      "luatexja-cid-std-" .. string.lower(cid_name) .. ".lua",
-      "luatexja-cid-auto-" .. string.lower(cid_name) .. ".lua",
-   }
-   local s
-   for i,v in ipairs(names) do
-      local localpath  = file.join(path.localdir, v)
-      local systempath = file.join(path.systemdir, v)
-      local kpsefound  = kpse.find_file(v)
-      if kpsefound and file.isreadable(kpsefound) then
-        cidfont_data[cid_name] = require(kpsefound)
-        cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
-        return
-      elseif file.isreadable(localpath)  then
-        cidfont_data[cid_name] = require(localpath)
-        cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
-        return
-      elseif file.isreadable(systempath) then
-        cidfont_data[cid_name] = require(systempath)
-        cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
-        return
-      end
+   local v = "ltj-cid-" .. string.lower(cid_name) .. ".lua"
+   local localpath  = file.join(path.localdir, v)
+   local systempath = file.join(path.systemdir, v)
+   local kpsefound  = kpse.find_file(v)
+   if kpsefound and file.isreadable(kpsefound) then
+      cidfont_data[cid_name] = require(kpsefound)
+      cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
+      return
+   elseif file.isreadable(localpath)  then
+      cidfont_data[cid_name] = require(localpath)
+      cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
+      return
+   elseif file.isreadable(systempath) then
+      cidfont_data[cid_name] = require(systempath)
+      cache_chars[cid_name]  = { [655360] = cidfont_data[cid_name].characters }
+      return
    end
-   -- Now we must create the virtual metrics from CMap.
-   ltjb.package_info('luatexja', 
-                       'I try to generate informations of non-embedded 2-byte fonts...', '')
-   make_cid_font()
+   --
 end
 
 -- High-level
similarity index 100%
rename from src/luatexja/stack.lua
rename to src/ltj-stack.lua
similarity index 100%
rename from src/luatexja/tangle.lua
rename to src/ltj-tangle.lua
index a09bad9..3cc57c5 100644 (file)
 
 \ifltj@in@latex                 %<*LaTeX>
   \NeedsTeXFormat{LaTeX2e}
-  \ProvidesPackage{luatexja-base}[2011/04/01 v0.1]
+  \ProvidesPackage{luatexja-base}[2011/04/20 v0.2]
 \fi                             %</LaTeX>
 
-
-%%------------------ Lua module loading
-
-%% Quark tokens needed in Lua modules.
-\protected\def\ltj@@q@escape{\ltj@@q@escape@}
-\protected\def\ltj@@q@escapenum{\ltj@@q@escapenum@}
-
-%% 
-\countdef\ltj@@count@zero=0 %
-\luatexattributedef\ltj@@attr@zero=0 %
-\dimendef\ltj@@dimen@zero=0 %
-\skipdef\ltj@@skip@zero=0 %
-
-%% Load Lua modules.
-\RequireLuaModule{luatexja.base}
-\RequireLuaModule{luatexja.tangle}
 %%------------------ Tiny helpers
 
 %% Registers
 \newcount\ltj@tempcnta
 \newcount\ltj@tempcntb
+\newcount\ltj@tempcntc
 \newdimen\ltj@tempdima
+\newskip\ltj@tempskipa
+\newtoks\ltj@temptoks
+
+\countdef\ltj@@count@zero=0 %
+\luatexattributedef\ltj@@attr@zero=0 %
+\dimendef\ltj@@dimen@zero=0 %
+\skipdef\ltj@@skip@zero=0 %
 
 %% Quarks
 %! ただ expl3 の quark とは異なり展開されるとエラーになる.
index e066ad3..5132c06 100644 (file)
@@ -84,7 +84,7 @@
 % Load core module if not yet.
 \ifx\luatexjacoreLoaded\@undefined
   \ifltj@in@latex                 %<*LaTeX>
-    \RequirePackage{luatexja-core}[2011/04/01]
+    \RequirePackage{luatexja-core}[2012/04/20]
   \else                           %<*!LaTeX>
     \input luatexja-core.sty %
   \fi                             %</LaTeX>
 % not yet implemented.
 
 %%------------------
-%! これ以降に LuaTeX 用の compat の内容を入れる.
-\RequireLuaModule{luatexja.jisx0208} %% JIS X 0208 => unicode のテーブル
-\RequireLuaModule{luatexja.compat}
+
+\directlua{
+  luatexja.load_module('jisx0208');
+  luatexja.load_module('compat');
+}
 
 \def\euc{\ltj@code@conv{euc}}
 \def\kuten{\ltj@code@conv{kuten}}
 \def\ucs{\ltj@code@conv{ucs}}
 
 \def\ltj@code@conv#1{%
-  \directlua{ luatexja._cc_next = luatexja.compat.from_#1 }%
+  \directlua{luatexja._cc_next = luatexja.compat.from_#1 }%
   \ltj@code@convA
 }
 \def\ltj@code@convA{%
    \ltj@code@convB\ltj@grab@num
 }
 \def\ltj@code@convB#1{%
-  \directlua{ luatexja._cc_next(\ltj@safe@num{#1}) }%
+  \directlua{luatexja._cc_next(\ltj@safe@num{#1}) }%
 }
 
 \def\kansuji{%
+\tracingall
   \expandafter\expandafter\expandafter
    \ltj@kansujiA\ltj@grab@num
 }
 \def\ltj@kansujiA#1{%
-  \directlua{ luatexja.compat.to_kansuji(\ltj@safe@num{#1}) }%
+  \directlua{luatexja.compat.to_kansuji(\ltj@safe@num{#1}) }%
 }
 \define@key[ltj]{japaram}{kansujichar}{%
   \expandafter\ltj@@set@stack#1:{ksj}{0}{0x7FFFFFFF}}
index 1a66f0c..18936df 100644 (file)
@@ -65,7 +65,7 @@
   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
     \csname iftrue\endcsname
   \NeedsTeXFormat{LaTeX2e}
-  \ProvidesPackage{luatexja-core}[2011/04/01 v0.1]
+  \ProvidesPackage{luatexja-core}[2012/04/20 v0.2]
 \fi                             %</LaTeX>
 
 %% Load prerequisite packages.
 \let\LuaTeXjaAvailable=t %
 
 %%------------------
-
-%% Load all sub-packages.
-\ifltj@in@latex                 %<*LaTeX>
-  \RequirePackage{luatexja-cctbreg}[2011/04/01]
-  \RequirePackage{luatexja-base}[2011/04/01]
-\else                           %<*!LaTeX>
-  \input luatexja-cctbreg.sty %
-  \input luatexja-base.sty %
-\fi                             %</LaTeX>
-
-%%------------------
 \endlinechar=13
 %! この中に master の luatexja-core.sty の内容を挿入する
 %! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
 \def\ltj@loaded{hoge}
 
-\newcount\ltj@tempcnta
-\newcount\ltj@tempcntb
-\newcount\ltj@tempcntc
-\newdimen\ltj@tempdima
-\newskip\ltj@tempskipa
-\newtoks\ltj@temptoks
-
 \newdimen\ltj@zw
 \newdimen\ltj@zh
 \newdimen\jQ \jQ=0.25mm
 \def\ltj@defnum{0}
 \def\ltj@defdimen{0}
 
-
 %%%%%%%% Attributes for Japanese typesetting.
 \newluatexattribute\ltj@curjfnt   % index for ``current Japanese font''
 \newluatexattribute\jfam          % index for current jfam
 \newluatexattribute\ltj@autoxspc  % attribute for autoxspacing
 \newluatexattribute\ltj@icflag    % attribute for italic correction
 
-%%%%%%%% Loading lua files
+%%%%%%%% Loading luatexja.lua
+%% Quark tokens needed in ltj-base
+\protected\def\ltj@@q@escape{\ltj@@q@escape@}
+\protected\def\ltj@@q@escapenum{\ltj@@q@escapenum@}
+
 \directlua{%
-  utf = unicode.utf8
-  ltj = {}
-  function ltj.loadlua(file)
-    local path = assert(kpse.find_file(file, 'tex'),
-      "File '"..file.."' not found")
-    texio.write_nl("("..path..")")
-    dofile(path)
+  luatexja = {}
+  function luatexja.error(s,t)
+    tex.error('LuaTeX-ja error: ' .. s ,t) 
+  end
+  function luatexja.load_module(name)
+     local fn = 'ltj-' .. name .. '.lua'
+     local found = kpse.find_file(fn, 'tex')
+     if not found then
+        luatexja.error("File `" .. fn .. "' not found", 
+             {'This file ' .. fn .. ' is required for LuaTeX-ja.', 'Please check your installation.'})
+     else 
+        texio.write('(' .. found .. ')')
+        require(found)
+     end
   end
-  ltj.loadlua('luatexja-core.lua')
+  local path = assert(kpse.find_file('luatexja.lua', 'tex'),
+      "File `luatexja.lua' not found")
+  dofile(path)
 }
 
+%%%%%%%% Load all sub-packages.
+\ifltj@in@latex                 %<*LaTeX>
+  \RequirePackage{luatexja-cctbreg}[2011/04/01]
+  \RequirePackage{luatexja-base}[2011/04/20]
+\else                           %<*!LaTeX>
+  \input luatexja-cctbreg.sty %
+  \input luatexja-base.sty %
+\fi                             %</LaTeX>
+
 
 %%%%%%%% Attributes for character ranges
 \ltj@tempcnta=0
   \advance\ltj@tempcnta by1
 \repeat
 
-
 %%%%%%%% \asluastring
 \def\asluastring#1{'\luaescapestring{\detokenize{#1}}'}
 
 
 %%%%%%%% \inhibitglue
 \protected\def\ltj@reset@globaldefs{%
-  \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}}
-\protected\def\ltj@restore@globaldefs{\directlua{tex.globaldefs = ltj.global_temp}}
+  \directlua{luatexja.global_temp = tex.globaldefs; tex.globaldefs = 0}}
+\protected\def\ltj@restore@globaldefs{\directlua{tex.globaldefs = luatexja.global_temp}}
 \let\new@everypar=\everypar
 \protected\def\inhibitglue{\relax%
   \ifvmode
 \define@key[ltj]{japaram}{postbreakpenalty}{%
   \expandafter\ltj@@set@stack#1:{post}{-10000}{10000}}
 \def\ltj@@set@stack#1,#2:#3#4#5{%
-  \directlua{luatexja.stack.set_stack_table(ltj.isglobal, \asluastring{#3},
+  \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, \asluastring{#3},
     \ltj@safe@num@or\ltj@defnum{#1},\ltj@safe@num@or\ltj@defnum{#2},#4,#5)}}
 
 % jatextfont = {<char_code>, <font_cs>}
     {\string#2 is not a control sequence that represents \MessageBreak
      a Japanese font}{}%
   \else
-    \directlua{luatexja.stack.set_stack_font(ltj.isglobal, \asluastring{#3},
+    \directlua{luatexja.stack.set_stack_font(luatexja.isglobal, \asluastring{#3},
     \ltj@safe@num@or\ltj@defnum{#1}, \the\ltj@curjfnt)}%
   \fi
   \ltj@curjfnt=\ltj@tempcnta
 % yalbaselineshift = <dimen>
 % yjabaselineshift = <dimen>
 \define@key[ltj]{japaram}{yalbaselineshift}{%
-  \directlua{tex.setattribute(ltj.isglobal, 
+  \directlua{tex.setattribute(luatexja.isglobal, 
     luatexbase.attributes['ltj@yablshift'],
     \ltj@safe@dimen@or\ltj@defdimen{#1})}}
 \define@key[ltj]{japaram}{yjabaselineshift}{%
-  \directlua{tex.setattribute(ltj.isglobal, 
+  \directlua{tex.setattribute(luatexja.isglobal, 
     luatexbase.attributes['ltj@ykblshift'],
     \ltj@safe@dimen@or\ltj@defdimen{#1})}}
 
   \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi
   \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi
   \def\ltj@tempa{allow}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{3}\fi
-  \directlua{luatexja.stack.set_stack_table(ltj.isglobal, 'xsp', 
+  \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, 'xsp', 
     \ltj@safe@num@or\ltj@defnum{#1},
     \ltj@safe@num@or\ltj@defnum{\ltj@temp},0,3)}}
 
   \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi
   \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi
   \def\ltj@tempa{allow}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{3}\fi
-  \directlua{luatexja.stack.set_stack_table(ltj.isglobal, 'xsp', 
+  \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, 'xsp', 
     \ltj@safe@num@or\ltj@defnum{#1},
     \ltj@safe@num@or\ltj@defnum{\ltj@temp},0,3)}}
 
 % autospacing = <bool> (default: true)
 \define@boolkey[ltj]{japaram}{autospacing}[true]{%
   \ifltj@japaram@autospacing
-    \directlua{ltj.ext_print_global()}\ltj@autospc=1
+    \directlua{luatexja.ext_print_global()}\ltj@autospc=1
   \else
-    \directlua{ltj.ext_print_global()}\ltj@autospc=0
+    \directlua{luatexja.ext_print_global()}\ltj@autospc=0
   \fi}
 
 % autoxspacing = <bool> (default: true)
 \define@boolkey[ltj]{japaram}{autoxspacing}[true]{%
   \ifltj@japaram@autoxspacing
-    \directlua{ltj.ext_print_global()}\ltj@autoxspc=1
+    \directlua{luatexja.ext_print_global()}\ltj@autoxspc=1
   \else
-    \directlua{ltj.ext_print_global()}\ltj@autoxspc=0
+    \directlua{luatexja.ext_print_global()}\ltj@autoxspc=0
   \fi}
 
 % [x]]kanjiskip = <dimen>
 \define@key[ltj]{japaram}{kanjiskip}{%              % SKIP
-  \directlua{luatexja.stack.set_stack_skip(ltj.isglobal, 'kanjiskip', \ltj@safe@glue{#1})}}
+  \directlua{luatexja.stack.set_stack_skip(luatexja.isglobal, 'kanjiskip', \ltj@safe@glue{#1})}}
 \define@key[ltj]{japaram}{xkanjiskip}{%             % SKIP
-  \directlua{luatexja.stack.set_stack_skip(ltj.isglobal, 'xkanjiskip', \ltj@safe@glue{#1})}}
+  \directlua{luatexja.stack.set_stack_skip(luatexja.isglobal, 'xkanjiskip', \ltj@safe@glue{#1})}}
 
 % jcharwidowpenalty = <count>
 \define@key[ltj]{japaram}{jcharwidowpenalty}{%      %COUNT
   \edef\ltj@temp{#1}%
   \ifx\ltj@temp\empty\let\next=\relax\else\let\next=\ltj@@scrange
     \directlua{luatexja.charrange.toggle_char_range(%
-      ltj.is_global,\ltj@safe@num@or\ltj@defnum{#1})}%
+      luatexja.is_global,\ltj@safe@num@or\ltj@defnum{#1})}%
   \fi\next
 }
 
 \protected\def\ltjsetparameter#1{%
-  \ifnum\globaldefs>0\directlua{ltj.isglobal='global'}\else\directlua{ltj.isglobal=''}\fi
+  \ifnum\globaldefs>0\directlua{luatexja.isglobal='global'}\else\directlua{luatexja.isglobal=''}\fi
   \setkeys[ltj]{japaram}{#1}\ignorespaces}
 \protected\def\ltjglobalsetparameter#1{%
-  \ifnum\globaldefs<0\directlua{ltj.isglobal=''}\else\directlua{ltj.isglobal='global'}\fi
+  \ifnum\globaldefs<0\directlua{luatexja.isglobal=''}\else\directlua{luatexja.isglobal='global'}\fi
   \setkeys[ltj]{japaram}{#1}\ignorespaces}
 
 %%%%%%%% \ltjgetparameter
   {\ltj@@getparam@one{#1}}%
 }
 \def\ltj@@getparam@one#1{%
-  \directlua{ltj.ext_get_parameter_unary('#1')}}%
+  \directlua{luatexja.ext_get_parameter_unary('#1')}}%
 \def\ltj@@getparam@two#1#2{%
-  \directlua{ltj.ext_get_parameter_binary('#1', \ltj@safe@num{#2})}%
+  \directlua{luatexja.ext_get_parameter_binary('#1', \ltj@safe@num{#2})}%
 }
 
 %%%%%%%% \ltjalchar<number>, \ltjjachar<number>
similarity index 86%
rename from src/luatexja-core.lua
rename to src/luatexja.lua
index 3752e26..e8812f9 100644 (file)
@@ -1,14 +1,37 @@
+
+local floor = math.floor
+
 require('lualibs')
-require('luatexja.rmlgbm');    local ltjr = luatexja.rmlgbm -- must be 1st
-require('luatexja.base');      local ltjb = luatexja.base
-require('luatexja.charrange'); local ltjc = luatexja.charrange
-require('luatexja.jfont');     local ltjf = luatexja.jfont
-require('luatexja.inputbuf');  local ltji = luatexja.inputbuf
-require('luatexja.jfmglue');   local ltjj = luatexja.jfmglue
-require('luatexja.math');      local ltjm = luatexja.math
-require('luatexja.pretreat');  local ltjp = luatexja.pretreat
-require('luatexja.stack');     local ltjs = luatexja.stack
-require('luatexja.setwidth');  local ltjw = luatexja.setwidth
+
+------------------------------------------------------------------------
+-- naming:
+--    ext_... : called from \directlua{}
+--    int_... : called from other Lua codes, but not from \directlua{}
+--    (other)     : only called from this file
+
+function luatexja.load_lua(fn)
+   local found = kpse.find_file(fn, 'tex')
+   if not found then
+      error("File `" .. fn .. "' not found")
+   else 
+      texio.write('(' .. found .. ')')
+      require(found)
+   end
+end
+
+local load_module = luatexja.load_module
+load_module('base');      local ltjb = luatexja.base
+load_module('rmlgbm');    local ltjr = luatexja.rmlgbm -- must be 1st
+load_module('charrange'); local ltjc = luatexja.charrange
+load_module('jfont');     local ltjf = luatexja.jfont
+load_module('inputbuf');  local ltji = luatexja.inputbuf
+load_module('stack');     local ltjs = luatexja.stack
+load_module('pretreat');  local ltjp = luatexja.pretreat
+load_module('jfmglue');   local ltjj = luatexja.jfmglue
+load_module('setwidth');  local ltjw = luatexja.setwidth
+load_module('math');      local ltjm = luatexja.math
+load_module('tangle');    local ltjb = luatexja.base
+
 
 local node_type = node.type
 local node_new = node.new
@@ -49,30 +72,20 @@ local PROCESSED = 8
 local IC_PROCESSED = 9
 local BOXBDD = 15
 
-------------------------------------------------------------------------
--- naming:
---    ltj.ext_... : called from \directlua{}
---    ltj.int_... : called from other Lua codes, but not from \directlua{}
---    (other)     : only called from this file
-
--- error messages
-function ltj.error(s,t)
-  tex.error('LuaTeX-ja error: ' .. s ,t) 
-end
 
 -- Three aux. functions, bollowed from tex.web
 local unity=65536
-function print_scaled(s)
+local function print_scaled(s)
    local out=''
    local delta=10
    if s<0 then 
       out=out..'-'; s=-s
    end
-   out=out..tostring(math.floor(s/unity)) .. '.'
+   out=out..tostring(floor(s/unity)) .. '.'
    s=10*(s%unity)+5
    repeat
       if delta>unity then s=s+32768-50000 end
-      out=out .. tostring(math.floor(s/unity)) 
+      out=out .. tostring(floor(s/unity)) 
       s=10*(s%unity)
       delta=delta*10
    until s<=delta
@@ -113,7 +126,7 @@ function math.two_average(a,b) return (a+b)/2 end
 ------------------------------------------------------------------------
 
 -- EXT: print parameters that don't need arguments
-function ltj.ext_get_parameter_unary(k)
+function luatexja.ext_get_parameter_unary(k)
    if k == 'yalbaselineshift' then
       tex.write(print_scaled(tex.getattribute('ltj@yablshift'))..'pt')
    elseif k == 'yjabaselineshift' then
@@ -143,8 +156,9 @@ function ltj.ext_get_parameter_unary(k)
    end
 end
 
+
 -- EXT: print parameters that need arguments
-function ltj.ext_get_parameter_binary(k,c)
+function luatexja.ext_get_parameter_binary(k,c)
    if k == 'jacharrange' then
       if c<0 or c>216 then 
         ltjb.package_error('luatexja',
@@ -178,8 +192,8 @@ function ltj.ext_get_parameter_binary(k,c)
 end
 
 -- EXT: print \global if necessary
-function ltj.ext_print_global()
-  if ltj.isglobal=='global' then tex.sprint(cat_lp, '\\global') end
+function luatexja.ext_print_global()
+  if isglobal=='global' then tex.sprint(cat_lp, '\\global') end
 end
 
 -- main process
@@ -191,28 +205,25 @@ local function main_process(head, mode, dir)
    return p
 end
 
+-- callbacks
+
+luatexbase.add_to_callback('pre_linebreak_filter', 
+   function (head,groupcode)
+      return main_process(head, true, tex.textdir)
+   end,'ltj.pre_linebreak_filter',
+   luatexbase.priority_in_callback('pre_linebreak_filter',
+                                  'luaotfload.pre_linebreak_filter') + 1)
+luatexbase.add_to_callback('hpack_filter', 
+  function (head,groupcode,size,packtype, dir)
+     return main_process(head, false, dir)
+  end,'ltj.hpack_filter',
+   luatexbase.priority_in_callback('hpack_filter',
+                                  'luaotfload.hpack_filter') + 1)
 
 -- debug
 local debug_depth
-function ltj.ext_show_node_list(head,depth,print_fn)
-   debug_depth = depth
-   if head then
-      while head do
-        debug_show_node_X(head, print_fn); head = node_next(head)
-      end
-   else
-      print_fn(debug_depth .. ' (null list)')
-   end
-end
-function ltj.ext_show_node(head,depth,print_fn)
-   debug_depth = depth
-   if head then
-      debug_show_node_X(head, print_fn)
-   else
-      print_fn(debug_depth .. ' (null list)')
-   end
-end
-function debug_show_node_X(p,print_fn)
+
+local function debug_show_node_X(p,print_fn)
    local k = debug_depth
    local s
    local pt=node_type(p.id)
@@ -233,7 +244,7 @@ function debug_show_node_X(p,print_fn)
       if p.glue_sign >= 1 then 
         s = s .. ' glue set '
         if p.glue_sign == 2 then s = s .. '-' end
-        s = s .. tostring(math.floor(p.glue_set*10000)/10000)
+        s = s .. tostring(floor(p.glue_set*10000)/10000)
         if p.glue_order == 0 then 
            s = s .. 'pt' 
         else 
@@ -319,19 +330,21 @@ function debug_show_node_X(p,print_fn)
    end
    p=node_next(p)
 end
-
-
--- callbacks
-
-luatexbase.add_to_callback('pre_linebreak_filter', 
-   function (head,groupcode)
-      return main_process(head, true, tex.textdir)
-   end,'ltj.pre_linebreak_filter',
-   luatexbase.priority_in_callback('pre_linebreak_filter',
-                                  'luaotfload.pre_linebreak_filter') + 1)
-luatexbase.add_to_callback('hpack_filter', 
-  function (head,groupcode,size,packtype, dir)
-     return main_process(head, false, dir)
-  end,'ltj.hpack_filter',
-   luatexbase.priority_in_callback('hpack_filter',
-                                  'luaotfload.hpack_filter') + 1)
+function luatexja.ext_show_node_list(head,depth,print_fn)
+   debug_depth = depth
+   if head then
+      while head do
+        debug_show_node_X(head, print_fn); head = node_next(head)
+      end
+   else
+      print_fn(debug_depth .. ' (null list)')
+   end
+end
+function luatexja.ext_show_node(head,depth,print_fn)
+   debug_depth = depth
+   if head then
+      debug_show_node_X(head, print_fn)
+   else
+      print_fn(debug_depth .. ' (null list)')
+   end
+end
\ No newline at end of file
index 2d76e92..3ec74a4 100644 (file)
Binary files a/test/test01-noembed.pdf and b/test/test01-noembed.pdf differ
index 49673da..aaf33fc 100644 (file)
Binary files a/test/test01.pdf and b/test/test01.pdf differ
index 8cea291..d210e89 100644 (file)
Binary files a/test/test02-latex.pdf and b/test/test02-latex.pdf differ
index 7b323e3..763e8b8 100644 (file)
@@ -1,6 +1,6 @@
 %#! lualatex
 \documentclass{ltjsarticle}
-\nonstopmode
+%\nonstopmode
 
 \makeatletter
 
@@ -85,7 +85,7 @@ font series `ix': 欧文は未定義,和文は機械的斜体.
 
 \newpage{\obeylines\tt
 \setbox0=\hbox{\gt\textsl{あいう■\textup{■え■}■おかき}}
-\directlua{ltj.ext_show_node_list(tex.box[0].head, '', tex.print)}\par}
+\directlua{luatexja.ext_show_node_list(tex.box[0].head, '', tex.print)}\par}
 
 \bigskip
 
index 548d8b6..c81a7de 100644 (file)
Binary files a/test/test03-after.pdf and b/test/test03-after.pdf differ
index 5de30b0..2c4eb77 100644 (file)
@@ -87,7 +87,7 @@ xspmode
 \char\jis{"346E}
 \char\kuten{"253C}
 \char\euc{"B0A5}
-\char\sjis"8A79
+\char\sjis{"8A79}
 %\char\sjis{"B4}
 %\char\euc"8EBE
 
index 5b679df..b336b6a 100644 (file)
Binary files a/test/test04-jfm.pdf and b/test/test04-jfm.pdf differ
index 1aa90e0..187f14e 100644 (file)
@@ -83,7 +83,7 @@
 \def\dumplist#1{\par\noindent\leavevmode
 \hbox to 0.2\hsize{\copy#1\hss}%
 \vbox{\hsize=0.6\hsize\sixtt\baselineskip=7.2pt\sixgt\let\\=\relax
-\directlua{ltj.ext_show_node_list(tex.getbox(#1).head, '\\par ', tex.print)}\hrule}}
+\directlua{luatexja.ext_show_node_list(tex.getbox(#1).head, '\\par ', tex.print)}\hrule}}
 
 %\tracingonline=1\tracingoutput=1\showboxdepth=3\showboxbreadth=100
 
index 9b1e3bf..8535d60 100644 (file)
Binary files a/test/test06-offset.pdf and b/test/test06-offset.pdf differ
index 461c51d..d1fc310 100644 (file)
@@ -13,7 +13,7 @@
 \def\dumplist#1{\par\noindent\leavevmode
 \hbox to 0.2\hsize{\copy#1\hss}%
 \vbox{\hsize=0.6\hsize\sixtt\baselineskip=7.2pt\sixgt\let\\=\relax
-\directlua{ltj.ext_show_node_list(tex.getbox(#1).head, '\\par ', tex.print)}\hrule}}
+\directlua{luatexja.ext_show_node_list(tex.getbox(#1).head, '\\par ', tex.print)}\hrule}}
 
 \ltjsetparameter{yalbaselineshift=0pt,yjabaselineshift=0pt}
 \setbox0=\hbox{\d Hy}\dumplist0
index e525190..f641229 100644 (file)
Binary files a/test/test07-math-unicode.pdf and b/test/test07-math-unicode.pdf differ
index 19df1ed..8f1f7ba 100644 (file)
Binary files a/test/test07-math.pdf and b/test/test07-math.pdf differ
index 5d5778b..5819668 100644 (file)
Binary files a/test/test08-tombow.pdf and b/test/test08-tombow.pdf differ
index 150b008..99d4f80 100644 (file)
Binary files a/test/test09-fontspec.pdf and b/test/test09-fontspec.pdf differ
index 64e0b69..806d207 100644 (file)
Binary files a/test/test10-otf.pdf and b/test/test10-otf.pdf differ
index 1773fbb..7038042 100755 (executable)
Binary files a/test/zh/cid-test.pdf and b/test/zh/cid-test.pdf differ