OSDN Git Service

ligature of JACHARs
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 8 Oct 2017 03:48:43 +0000 (12:48 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 8 Oct 2017 03:48:43 +0000 (12:48 +0900)
src/jfm-ujisv.lua
src/ltj-jfmglue.lua
src/luatexja.lua

index 8f89011..029ff96 100644 (file)
@@ -280,17 +280,15 @@ for i,v in pairs(t) do
     if v.kern and v.kern[0] then v.kern[100] = v.kern[0] end
   end
 end
-
--- [[
 t[200]=table.fastcopy(t[0])
 t[200].chars={'〱', '〲'}
-t[200].width = 2
+t[200].width = 2.0
+t[200].left=-0.5
 for i,v in pairs(t) do
-  if i~=6 and type(i)=='number' and type(v)=='table' then -- 感嘆符以外
+  if type(v)=='table' then
     if v.glue and v.glue[0] then v.glue[200] = v.glue[0] end
     if v.kern and v.kern[0] then v.kern[200] = v.kern[0] end
   end
 end
--- ]]
 
 luatexja.jfont.define_jfm(t)
index d33f032..1e35416 100644 (file)
@@ -569,16 +569,17 @@ do
    local attr_jchar_code = luatexbase.attributes['ltj@charcode']
    local attr_autospc = luatexbase.attributes['ltj@autospc']
    local attr_autoxspc = luatexbase.attributes['ltj@autoxspc']
+   local getcomponents = node.direct.getcomponents
    --local ltjf_get_vert_glyph = ltjf.get_vert_glyph
    function set_np_xspc_jachar(Nx, x)
       local m = ltjf_font_metric_table[getfont(x)]
-      local c, c_glyph = ltjs_orig_char_table[x], getchar(x)
+      local c, c_glyph = (not getcomponents(x) and ltjs_orig_char_table[x]), getchar(x)
+      if c and c~=c_glyph then set_attr(x, attr_jchar_code, c) end
       c = c or c_glyph
       local cls = slow_find_char_class(c, m, c_glyph)
       Nx.met, Nx.class, Nx.char = m, cls, c;
       local mc = m.char_type; Nx.char_type = mc
       if cls~=0 then set_attr(x, attr_jchar_class, cls) end
-      if c~=c_glyph then set_attr(x, attr_jchar_code, c) end
       Nx.pre  = table_current_stack[PRE + c]  or 0
       Nx.post = table_current_stack[POST + c] or 0
       Nx.xspc = table_current_stack[XSP  + c] or 3
@@ -603,9 +604,9 @@ do
    function set_np_xspc_alchar(Nx, c,x, lig)
       if c~=-1 then
         local f = (lig ==1) and nullfunc or node_tail
-         local xc, xs = getfield(x, 'components'), getsubtype(x)
+         local xc, xs = getcomponents(x), getsubtype(x)
         while xc and xs and xs%4>=2 do
-           x = f(xc); xc, xs = getfield(x, 'components'), getsubtype(x)
+           x = f(xc); xc, xs = getcomponents(x), getsubtype(x)
         end
         c = getchar(x)
         Nx.pre  = table_current_stack[PRE + c]  or 0
index 1df8d03..422035e 100644 (file)
@@ -410,9 +410,9 @@ local function debug_show_node_X(p,print_fn, limit)
    local base = prefix .. string.format('%X', get_attr_icflag(p))
    .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' '
    if pt == 'glyph' then
-      s = base .. ' ' .. utf.char(p.char) .. ' '
-         .. tostring(p.font)
-         .. ' (' .. print_scaled(p.height) .. '+'
+      s = base .. ' ' .. 
+         (p.char>=0xF0000 and string.format('(U+%X)', p.char) or utf.char(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
          s = s .. ' off: (' .. print_scaled(p.xoffset)