OSDN Git Service

typo
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 30 Jul 2020 12:16:51 +0000 (21:16 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 30 Jul 2020 12:16:51 +0000 (21:16 +0900)
src/ltj-lineskip.lua
src/ltj-math.lua
src/ltj-otf.lua
src/luatexja.lua
test/test10-otf.pdf
test/test10-otf.tex

index f5c439e..1fc6f7b 100644 (file)
@@ -1,15 +1,15 @@
 --
 -- ltj-lineskip.lua
 --
-luatexja.load_module('base'); local ltjb = luatexja.base
-luatexja.load_module('direction'); local ltjd = luatexja.direction
+luatexja.load_module 'base'; local ltjb = luatexja.base
+luatexja.load_module 'direction'; local ltjd = luatexja.direction
 luatexja.lineskip = luatexja.lineskip or {}
 
 local to_direct = node.direct.todirect
 local ltjl = luatexja.lineskip
-local id_glue = node.id('glue')
-local id_penalty = node.id('penalty')
-local id_hlist = node.id('hlist')
+local id_glue    = node.id 'glue'
+local id_penalty = node.id 'penalty'
+local id_hlist   = node.id 'hlist'
 local setfield = node.direct.setfield
 local getfield = node.direct.getfield
 local getlist = node.direct.getlist
@@ -46,71 +46,66 @@ function ltjl.setting(profiler, skip_method)
 end
 
 do
-   local traverse_id = node.direct.traverse_id
-   local function adjust_glue(nh)
-      local h = to_direct(nh)
-      local bw = tex.baselineskip.width
-      for x in traverse_id(id_glue, h) do
-        local xs = getsubtype(x)
-        if (xs==1) or (xs==2) then
-           local p, n = node_prev(x), node_next(x)
-           if p then
-              local pid = getid(p)
-             while (id_glue<=pid) and (pid<=id_penalty) and node_prev(p) do 
-               p = node_prev(p); pid = getid(p)
-             end
-             if pid==id_hlist and getid(n)==id_hlist then
-                local normal = bw - getfield(p, 'depth') - getfield(n, 'height')
-                local lmin, adj = ltj_profiler(p, n, false, bw)
-                ltj_skip(lmin or normal, x, adj, normal, bw)
-              end
+local traverse_id = node.direct.traverse_id
+local function adjust_glue(nh)
+   local h = to_direct(nh)
+   local bw = tex.baselineskip.width
+   for x in traverse_id(id_glue, h) do
+     local xs = getsubtype(x)
+     if (xs==1) or (xs==2) then
+        local p, n = node_prev(x), node_next(x)
+        if p then
+        local pid = getid(p)
+           while (id_glue<=pid) and (pid<=id_penalty) and node_prev(p) do 
+             p = node_prev(p); pid = getid(p)
+           end
+           if pid==id_hlist and getid(n)==id_hlist then
+             local normal = bw - getfield(p, 'depth') - getfield(n, 'height')
+             local lmin, adj = ltj_profiler(p, n, false, bw)
+             ltj_skip(lmin or normal, x, adj, normal, bw)
            end
         end
-      end
-      return true
+     end
    end
-   ltjb.add_to_callback('post_linebreak_filter', 
-      adjust_glue, 'ltj.lineskip', 10000)
+   return true
+end
+ltjb.add_to_callback('post_linebreak_filter', adjust_glue, 'ltj.lineskip', 10000)
 end
 
 do
-   local p_dummy = ltjl.p_dummy
-   local make_dir_whatsit = luatexja.direction.make_dir_whatsit
-   local get_dir_count = luatexja.direction.get_dir_count
-   local node_write = node.direct.write
+local p_dummy = ltjl.p_dummy
+local make_dir_whatsit = luatexja.direction.make_dir_whatsit
+local get_dir_count = luatexja.direction.get_dir_count
+local node_write = node.direct.write
 
-   local function dir_adjust_append_vlist(b, loc, prev, mirrored)
-      local old_b = to_direct(b)
-      local new_b = loc=='box' and 
-        make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b      
-      if prev > -65536000 then
-         local bw = tex.baselineskip.width
-        local normal = bw - prev 
-           - getfield(new_b, mirrored and 'depth' or 'height')
-         local lmin, adj = nil, 0
-         local tail = to_direct(tex.nest[tex.nest.ptr].tail)
-         if p_dummy~=ltj_profiler then
-            while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do
-               tail = node_prev(tail)
+local function dir_adjust_append_vlist(b, loc, prev, mirrored)
+   local old_b = to_direct(b)
+   local new_b = loc=='box' and 
+      make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b
+   if prev > -65536000 then
+      local bw = tex.baselineskip.width
+      local normal = bw - prev - getfield(new_b, mirrored and 'depth' or 'height')
+      local lmin, adj = nil, 0
+      local tail = to_direct(tex.nest[tex.nest.ptr].tail)
+      if p_dummy~=ltj_profiler then
+         while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do
+            tail = node_prev(tail)
+         end
+      end
+      if tail then
+         if getid(tail)==id_hlist and getid(new_b)==id_hlist then
+            if getfield(tail, 'depth')==prev then 
+               lmin, adj = ltj_profiler(tail, new_b, mirrored, bw)
             end
          end
-        if tail then
-           if getid(tail)==id_hlist and getid(new_b)==id_hlist then
-              if getfield(tail, 'depth')==prev then 
-                 lmin, adj = ltj_profiler(tail, new_b, mirrored, bw)
-              end
-           end
-        end
-        local g = node_new(id_glue)
-         ltj_skip(lmin or normal, g, adj, normal, bw, loc)
-        node_write(g)
       end
-      node_write(new_b)
-      tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth')
-      return nil -- do nothing on tex side
+      local g = node_new(id_glue)
+      ltj_skip(lmin or normal, g, adj, normal, bw, loc); node_write(g)
    end
-   ltjb.add_to_callback('append_to_vlist_filter',
-                       dir_adjust_append_vlist,
-                       'ltj.lineskip', 10000)
+   node_write(new_b)
+   tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth')
+   return nil -- do nothing on tex side
+end
+ltjb.add_to_callback('append_to_vlist_filter', dir_adjust_append_vlist, 'ltj.lineskip', 10000)
 end
 
index b6ef1a9..2a7c044 100644 (file)
@@ -2,12 +2,12 @@
 -- ltj-math.lua
 --
 
-luatexja.load_module('base');      local ltjb = luatexja.base
-luatexja.load_module('direction'); local ltjd = luatexja.direction
-luatexja.load_module('charrange'); local ltjc = luatexja.charrange
-luatexja.load_module('jfont');     local ltjf = luatexja.jfont
-luatexja.load_module('stack');     local ltjs = luatexja.stack
-luatexja.load_module('setwidth');  local ltjw = luatexja.setwidth
+luatexja.load_module 'base';      local ltjb = luatexja.base
+luatexja.load_module 'direction'; local ltjd = luatexja.direction
+luatexja.load_module 'charrange'; local ltjc = luatexja.charrange
+luatexja.load_module 'jfont';     local ltjf = luatexja.jfont
+luatexja.load_module 'stack';     local ltjs = luatexja.stack
+luatexja.load_module 'setwidth';  local ltjw = luatexja.setwidth
 
 local setfield = node.direct.setfield
 local getfield = node.direct.getfield
@@ -36,20 +36,20 @@ local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
 local attr_jfam = luatexbase.attributes['jfam']
 local attr_yablshift = luatexbase.attributes['ltj@yablshift']
 
-local id_glyph = node.id('glyph')
-local id_hlist = node.id('hlist')
-local id_vlist = node.id('vlist')
-local id_mchar = node.id('math_char')
-local id_sub_box = node.id('sub_box')
-local id_radical = node.id('radical')
-local id_choice  = node.id('choice')
-local id_accent  = node.id('accent')
-local id_style   = node.id('style')
-local id_frac    = node.id('fraction')
-local id_simple  = node.id('noad')
-local id_sub_mlist = node.id('sub_mlist')
-local id_whatsit = node.id('whatsit')
-local sid_user = node.subtype('user_defined')
+local id_glyph   = node.id 'glyph'
+local id_hlist   = node.id 'hlist'
+local id_vlist   = node.id 'vlist'
+local id_mchar   = node.id 'math_char'
+local id_sub_box = node.id 'sub_box'
+local id_radical = node.id 'radical'
+local id_choice  = node.id 'choice'
+local id_accent  = node.id 'accent'
+local id_style   = node.id 'style'
+local id_frac    = node.id 'fraction'
+local id_simple  = node.id 'noad'
+local id_sub_mlist = node.id 'sub_mlist'
+local id_whatsit = node.id 'whatsit'
+local sid_user = node.subtype 'user_defined'
 local DIR  = luatexja.userid_table.DIR
 local dir_node_auto   = luatexja.dir_table.dir_node_auto
 
@@ -66,56 +66,54 @@ local list_dir
 
 -- vcenter noad は軸に揃えるため,欧文ベースライン補正がかかる
 local function conv_vcenter(sb)
-   local h = getfield(sb, 'head');local hd = getlist(h)
-   if getid(hd)==id_whatsit and 
-   getsubtype(hd)==sid_user and getfield(hd, 'user_id')==DIR then
+   local h = getfield(sb, 'head'); local hd = getlist(h)
+   if getid(hd)==id_whatsit and getsubtype(hd)==sid_user 
+      and getfield(hd, 'user_id')==DIR then
       local d = node_next(hd)
       if getid(d)==id_vlist and has_attr(d, attr_dir)>=dir_node_auto then
-        node_free(hd); setfield(h, 'head', nil); node_free(h)
-        setfield(sb, 'head', d);  set_attr(d, attr_icflag, 0)
+         node_free(hd); setfield(h, 'head', nil); node_free(h)
+         setfield(sb, 'head', d);  set_attr(d, attr_icflag, 0)
       end
    end
    return sb
 end
 
-local conv_jchar_to_hbox_A
-
+local cjhh_A
 -- sty : 0 (display or text), 1 (script), >=2 (scriptscript)
 local function conv_jchar_to_hbox(head, sty)
    for p in node_traverse(head) do
       local pid = getid(p)
       if pid == id_simple or pid == id_accent then
-        if getsubtype(p)==12 then
-           conv_vcenter(getfield(p, 'nucleus'))
-        else
-           setfield(p, 'nucleus', conv_jchar_to_hbox_A(getfield(p, 'nucleus'), sty))
-        end
-        setfield(p, 'sub', conv_jchar_to_hbox_A(getfield(p, 'sub'), sty+1))
-        setfield(p, 'sup', conv_jchar_to_hbox_A(getfield(p, 'sup'), sty+1))
+         if getsubtype(p)==12 then
+            conv_vcenter(getfield(p, 'nucleus'))
+         else
+            setfield(p, 'nucleus', cjh_A(getfield(p, 'nucleus'), sty))
+         end
+         setfield(p, 'sub', cjh_A(getfield(p, 'sub'), sty+1))
+         setfield(p, 'sup', cjh_A(getfield(p, 'sup'), sty+1))
       elseif pid == id_choice then
-        setfield(p, 'display', conv_jchar_to_hbox_A(getfield(p, 'display'), 0))
-        setfield(p, 'text', conv_jchar_to_hbox_A(getfield(p, 'text'), 0))
-        setfield(p, 'script', conv_jchar_to_hbox_A(getfield(p, 'script'), 1))
-        setfield(p, 'scriptscript', conv_jchar_to_hbox_A(getfield(p, 'scriptscript'), 2))
+         setfield(p, 'display', cjh_A(getfield(p, 'display'), 0))
+         setfield(p, 'text', cjh_A(getfield(p, 'text'), 0))
+         setfield(p, 'script', cjh_A(getfield(p, 'script'), 1))
+         setfield(p, 'scriptscript', cjh_A(getfield(p, 'scriptscript'), 2))
       elseif pid == id_frac then
-        setfield(p, 'num', conv_jchar_to_hbox_A(getfield(p, 'num'), sty+1))
-        setfield(p, 'denom', conv_jchar_to_hbox_A(getfield(p, 'denom'), sty+1))
+         setfield(p, 'num', cjh_A(getfield(p, 'num'), sty+1))
+         setfield(p, 'denom', cjh_A(getfield(p, 'denom'), sty+1))
       elseif pid == id_radical then
-        setfield(p, 'nucleus', conv_jchar_to_hbox_A(getfield(p, 'nucleus'), sty))
-        setfield(p, 'sub', conv_jchar_to_hbox_A(getfield(p, 'sub'), sty+1))
-        setfield(p, 'sup', conv_jchar_to_hbox_A(getfield(p, 'sup'), sty+1))
-        if getfield(p, 'degree') then
-           setfield(p, 'degree', conv_jchar_to_hbox_A(getfield(p, 'degree'), sty + 1))
-        end
+         setfield(p, 'nucleus', cjh_A(getfield(p, 'nucleus'), sty))
+         setfield(p, 'sub', cjh_A(getfield(p, 'sub'), sty+1))
+         setfield(p, 'sup', cjh_A(getfield(p, 'sup'), sty+1))
+         if getfield(p, 'degree') then
+            setfield(p, 'degree', cjh_A(getfield(p, 'degree'), sty + 1))
+         end
       elseif pid == id_style then
-        local ps = getfield(p, 'style')
-        if ps == "display'" or  ps == 'display'
-           or  ps == "text'" or  ps == 'text' then
-           sty = 0
-        elseif  ps == "script'" or  ps == 'script' then
-           sty = 1
-        else sty = 2
-        end
+         local ps = getfield(p, 'style')
+         if ps == "display'" or  ps == 'display' or ps == "text'" or ps == 'text' then
+            sty = 0
+         elseif  ps == "script'" or  ps == 'script' then
+            sty = 1
+         else sty = 2
+         end
        end
    end
    return head
@@ -127,8 +125,7 @@ local MJSS = luatexja.stack_table_index.MJSS
 local capsule_glyph_math = ltjw.capsule_glyph_math
 local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
 
-conv_jchar_to_hbox_A =
-function (p, sty)
+cjh_A = function (p, sty)
    if not p then return nil
    else
       local pid = getid(p)
@@ -137,29 +134,24 @@ function (p, sty)
             setfield(p, 'head', conv_jchar_to_hbox(getfield(p, 'head'), sty))
          end
       elseif pid == id_mchar then
-         local fam = has_attr(p, attr_jfam) or -1
-        local pc = getchar(p)
+         local pc, fam = getchar (p), has_attr(p, attr_jfam) or -1
          if (not is_math_letters[pc]) and is_ucs_in_japanese_char(p) and fam>=0 then
             local f = ltjs.get_stack_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack'))
             if f ~= -1 then
                local q = node_new(id_sub_box)
                local r = node_new(id_glyph); setfield(r, 'next', nil)
                setfield(r, 'char', pc); setfield(r, 'font', f); setfield(r, 'subtype', 256)
-               local k = has_attr(r,attr_ykblshift) or 0
-               set_attr(r, attr_ykblshift, 0)
+               local k = has_attr(r,attr_ykblshift) or 0; set_attr(r, attr_ykblshift, 0)
                -- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避
                local met = ltjf_font_metric_table[f]
                r = capsule_glyph_math(r, met, met.char_type[ltjf_find_char_class(pc, met)]);
-               setfield(q, 'head', r); node_free(p); p=q;
-               set_attr(r, attr_yablshift, k)
+               setfield(q, 'head', r); node_free(p); p=q; set_attr(r, attr_yablshift, k)
             end
          end
       elseif pid == id_sub_box and getfield(p, 'head') then
          -- \hbox で直に与えられた内容は上下位置を補正する必要はない
-        local h = getfield(p, 'head')
-        h = ltjd_make_dir_whatsit(h, h, list_dir, 'math')
-        setfield(p, 'head', h)
-         set_attr(h, attr_icflag, PROCESSED)
+         local h = getfield(p, 'head'); h = ltjd_make_dir_whatsit(h, h, list_dir, 'math')
+         setfield(p, 'head', h); set_attr(h, attr_icflag, PROCESSED)
       end
    end
    return p
@@ -168,8 +160,7 @@ end
 do
   local function mlist_callback_ltja(n)
     local n = to_direct(n); list_dir = ltjd_get_dir_count()
-    if getid(n)==id_whatsit and getsubtype(n)==sid_user and
-        getfield(n, 'user_id') == DIR then
+    if getid(n)==id_whatsit and getsubtype(n)==sid_user and getfield(n, 'user_id') == DIR then
       local old_n = n; n = node_remove(n, n)
       node_free(old_n); if not n then return nil end
     end
index 3792fab..56c0154 100644 (file)
@@ -1,20 +1,20 @@
 --
 -- ltj-otf.lua
 --
-require('unicode')
-require('lualibs')
+require 'unicode'
+require 'lualibs'
 
-luatexja.load_module('base');      local ltjb = luatexja.base
-luatexja.load_module('jfont');     local ltjf = luatexja.jfont
-luatexja.load_module('rmlgbm');    local ltjr = luatexja.rmlgbm
-luatexja.load_module('charrange'); local ltjc = luatexja.charrange
-luatexja.load_module('direction'); local ltjd = luatexja.direction
-luatexja.load_module('stack');     local ltjs = luatexja.stack
-luatexja.load_module('lotf_aux');  local ltju = luatexja.lotf_aux
+luatexja.load_module 'base';      local ltjb = luatexja.base
+luatexja.load_module 'jfont';     local ltjf = luatexja.jfont
+luatexja.load_module 'rmlgbm';    local ltjr = luatexja.rmlgbm
+luatexja.load_module 'charrange'; local ltjc = luatexja.charrange
+luatexja.load_module 'direction'; local ltjd = luatexja.direction
+luatexja.load_module 'stack';     local ltjs = luatexja.stack
+luatexja.load_module 'lotf_aux';  local ltju = luatexja.lotf_aux
 
-local id_glyph = node.id('glyph')
-local id_whatsit = node.id('whatsit')
-local sid_user = node.subtype('user_defined')
+local id_glyph = node.id 'glyph'
+local id_whatsit = node.id 'whatsit'
+local sid_user = node.subtype 'user_defined'
 
 local setfield = node.direct.setfield
 local getfield = node.direct.getfield
@@ -22,10 +22,8 @@ local getid = node.direct.getid
 local getfont = node.direct.getfont
 local getchar = node.direct.getchar
 local getsubtype = node.direct.getsubtype
-
 local to_node = node.direct.tonode
 local to_direct = node.direct.todirect
-
 local node_new = node.direct.new
 local node_remove = node.direct.remove
 local node_next = node.direct.getnext
@@ -37,7 +35,6 @@ local node_insert_after = node.direct.insert_after
 local node_write = node.direct.write
 local node_traverse_id = node.direct.traverse_id
 
-
 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
 local attr_curtfnt = luatexbase.attributes['ltj@curtfnt']
 local attr_yablshift = luatexbase.attributes['ltj@yablshift']
@@ -73,13 +70,12 @@ local function get_ucs_from_rmlgbm(c)
       or ltjr_cidfont_data["Adobe-Japan1"].resources.unicodes["Japan1." .. tostring(c)])
       or 0
    if v>=0x200000 then -- table
-      local curjfnt = tex_get_attr((ltjd_get_dir_count()==dir_tate)
-                                   and attr_curtfnt or attr_curjfnt)
+      local curjfnt = tex_get_attr(
+        (ltjd_get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
       local tfmdata = font_getfont(curjfnt)
       if tfmdata and tfmdata.resources then
         local base, ivs = v % 0x200000, 0xE00FF + math.floor(v/0x200000)
-        curjfnt = tfmdata.resources.variants
-        curjfnt = curjfnt and curjfnt[ivs]
+        curjfnt = tfmdata.resources.variants; curjfnt = curjfnt and curjfnt[ivs]
         return curjfnt and curjfnt[base] or base
       else return base
       end
@@ -110,7 +106,7 @@ local function get_ucs_from_rmlgbm(c)
          -- CID が縦組用字形だった場合
          return ltju.replace_vert_variant(
             tex_get_attr((ltjd_get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt),
-           r)
+            r)
       end
       return r
    end
@@ -130,7 +126,7 @@ do
       if ltjd_get_dir_count()==dir_tate then
          ucs = ltju.replace_vert_variant(
             tex_get_attr((ltjd_get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt),
-           ucs)
+            ucs)
       end
       return append_jglyph(ucs)
    end
@@ -138,21 +134,19 @@ end
 
 local cid
 do
+   local ord = {
+      ['Japan1']=true, ['GB1']=true, ['CNS1']=true, ['Korea1']=true, ['KR']=true
+   }
    cid = function (key)
       if key==0 then return append_jglyph(0) end
-      local curjfnt = tex_get_attr((ltjd_get_dir_count()==dir_tate)
-                                        and attr_curtfnt or attr_curjfnt)
+      local curjfnt = tex_get_attr(
+         (ltjd_get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
       local cidinfo = ltju.get_cidinfo(curjfnt)
-      if type(cidinfo)~="table" or
-         cidinfo.ordering ~= "Japan1" and
-         cidinfo.ordering ~= "GB1" and
-         cidinfo.ordering ~= "CNS1" and
-         cidinfo.ordering ~= "Korea1" and
-         cidinfo.ordering ~= "KR" then
+      if type(cidinfo)~="table" or not ord[cidinfo.ordering] then
             return append_jglyph(get_ucs_from_rmlgbm(key))
       else
-        local char = ltjf_font_extra_info[curjfnt].ind_to_uni[key] or 0
-        return append_jglyph(char)
+         local char = ltjf_font_extra_info[curjfnt].ind_to_uni[key] or 0
+         return append_jglyph(char)
       end
    end
 end
@@ -169,17 +163,12 @@ local function extract(head)
          if getsubtype(p)==sid_user then
             local puid = getfield(p, 'user_id')
             if puid==OTF then
-            --if puid==OTF or puid==VSR then
                local g = node_new(id_glyph)
                setfield(g, 'subtype', 0)
-              setfield(g, 'char', getfield(p, 'value'))
-               local v = has_attr(p, attr_curfnt); setfield(g, 'font',v)
-               --if puid==OTF then
-                  setfield(g, 'lang', lang_ja)
-                  set_attr(g, attr_kblshift, has_attr(p, attr_kblshift))
-               --else
-               --   set_attr(g, attr_ablshift, has_attr(p, attr_ablshift))
-               --end
+               setfield(g, 'char', getfield(p, 'value'))
+               local v = has_attr(p, attr_curfnt); setfield(g, 'font', v)
+               setfield(g, 'lang', lang_ja)
+               set_attr(g, attr_kblshift, has_attr(p, attr_kblshift))
                head = node_insert_after(head, p, g)
                head = node_remove(head, p)
                node_free(p); p = g
@@ -206,20 +195,20 @@ local function ind_to_uni(fmtable, fn)
    local t = ltjf_font_extra_info[fn]; t = t and t.ind_to_uni
    if t and cid.ordering == "Japan1" then
       for i, v in pairs(fmtable.chars) do
-        local j = string.match(i, "^AJ1%-([0-9]*)")
-        if j then
-           j = t[i]
-           if j then
-              fmtable.cid_char_type = fmtable.cid_char_type  or {}
-              fmtable.cid_char_type[j] = v
-           end
-        end
+         local j = string.match(i, "^AJ1%-([0-9]*)")
+         if j then
+            j = t[i]
+            if j then
+               fmtable.cid_char_type = fmtable.cid_char_type  or {}
+               fmtable.cid_char_type[j] = v
+            end
+         end
       end
    end
    return fmtable
 end
 luatexbase.add_to_callback("luatexja.define_jfont",
-                          ind_to_uni, "ltj.otf.define_jfont", 1)
+                           ind_to_uni, "ltj.otf.define_jfont", 1)
 --  既に読み込まれているフォントに対しても,同じことをやらないといけない
 for fn, v in pairs(ltjf_font_metric_table) do
    ltjf_font_metric_table[fn] = ind_to_uni(v, fn)
@@ -234,12 +223,12 @@ local function cid_set_char_class(arg, fmtable, char)
    end
 end
 luatexbase.add_to_callback("luatexja.find_char_class",
-                          cid_set_char_class, "ltj.otf.find_char_class", 1)
+                           cid_set_char_class, "ltj.otf.find_char_class", 1)
 
 --IVS
 local function enable_ivs()
   ltjb.package_warning('luatexja-otf',
-    'luatexja.otf.enable_ivs() has now no effect.')
+     'luatexja.otf.enable_ivs() has now no effect.')
 end
 local disable_ivs = enable_ivs
 
index 30fce93..988f519 100644 (file)
@@ -44,7 +44,6 @@ icflag_table.IC_PROCESSED    = 74
 icflag_table.BOXBDD          = 75
 icflag_table.PROCESSED_BEGIN_FLAG = 4096 -- sufficiently large power of 2
 
-do
 local stack_ind = {}
 luatexja.stack_table_index = stack_ind
 stack_ind.PRE  = 0x200000 -- characterごと
@@ -60,9 +59,7 @@ stack_ind.MJT  = 0x100 -- 0--255
 stack_ind.MJS  = 0x200 -- 0--255
 stack_ind.MJSS = 0x300 -- 0--255
 stack_ind.KSJ  = 0x400 -- 0--9
-end
 
-do
 local uid_table = {}
 luatexja.userid_table = uid_table
 uid_table.IHB  = luatexbase.newuserwhatsitid('inhibitglue',  'luatexja') -- \inhibitglue
@@ -71,9 +68,7 @@ uid_table.BPAR = luatexbase.newuserwhatsitid('begin_par',    'luatexja') -- 「
 uid_table.DIR  = luatexbase.newuserwhatsitid('direction',    'luatexja') -- 組方向
 uid_table.BOXB = luatexbase.newuserwhatsitid('box_boundary', 'luatexja') -- 「ボックス始め・終わり」
 uid_table.JA_AL_BDD = luatexbase.newuserwhatsitid('ja_al_boundary', 'luatexja')
-end
 
-do
 local dir_table = {}
 luatexja.dir_table = dir_table
 dir_table.dir_dtou = 1
@@ -84,7 +79,6 @@ dir_table.dir_node_auto   = 128 -- 組方向を合わせるために自動で作
 dir_table.dir_node_manual = 256 -- 寸法代入によって作られたもの
 dir_table.dir_utod = dir_table.dir_tate + dir_table.dir_math_mod
   -- 「縦数式ディレクション」 in pTeX
-end
 --- 定義終わり
 
 local load_module = luatexja.load_module
index e4193a0..80b578a 100644 (file)
Binary files a/test/test10-otf.pdf and b/test/test10-otf.pdf differ
index c13431e..4d018dd 100644 (file)
@@ -3,11 +3,12 @@
 \usepackage{luacode}
 \usepackage{luatexja-otf,lltjext}
 \usepackage[sourcehan]{luatexja-preset}
+%\usepackage[hiragino-pron]{luatexja-preset}
 \begin{document}
 
 ※このファイルは源ノ明朝・源ノ角ゴシックを埋め込んでいます.
 
-森\UTF{9DD7}外と田百\UTF{9592}とが\UTF{9AD9}島屋に行くところを想像した。
+森\UTF{9DD7}外と\UTF{5167}田百\UTF{9592}とが\UTF{9AD9}島屋に行くところを想像した。
 
 \CID{7652}飾区の\CID{13706}野屋