OSDN Git Service

Make lltjp-geometry.sty to work with pLaTeX.
[luatex-ja/luatexja.git] / src / ltj-jfmglue.lua
index 3da2877..c16239b 100644 (file)
@@ -112,8 +112,8 @@ do
    local stop_time_measure = ltjb.stop_time_measure
    slow_find_char_class = function (c, m, oc)
       local cls = ltjf_find_char_class(oc, m)
-      if oc~=c and cls==0 then
-        return ltjf_find_char_class(-c, m), oc
+      if c and oc~=c and cls==0 then
+        return ltjf_find_char_class(c, m), oc
       else
         return cls, oc
       end
@@ -320,7 +320,7 @@ local min, max = math.min, math.max
 local function calc_np_aux_glyph_common(lp)
    Np.nuc = lp
    Np.id = npi
-   if ltjs_orig_char_table[lp] then
+   if getfield(lp, 'lang') == lang_ja then
       Np.id = id_jglyph
       set_np_xspc_jachar(Np, lp)
       local npi, npf
@@ -345,7 +345,7 @@ local function calc_np_aux_glyph_common(lp)
            lp=lx; break
         else
            local lid = getid(lx)
-           if lid==id_glyph and not ltjs_orig_char_table[lx] then
+           if lid==id_glyph and getfield(lx, 'lang') ~= lang_ja then
               -- 欧文文字
               last_glyph = lx; set_attr(lx, attr_icflag, PROCESSED); Np.last = lx
               y_adjust = has_attr(lx,attr_ablshift) or 0
@@ -564,7 +564,7 @@ do
    local attr_jchar_class = luatexbase.attributes['ltj@charclass']
    local attr_autospc = luatexbase.attributes['ltj@autospc']
    local attr_autoxspc = luatexbase.attributes['ltj@autoxspc']
-   local ltjf_get_vert_glyph = ltjf.get_vert_glyph
+   --local ltjf_get_vert_glyph = ltjf.get_vert_glyph
    function set_np_xspc_jachar_yoko(Nx, x)
       local m = ltjf_font_metric_table[getfont(x)]
       local cls, c = slow_find_char_class(ltjs_orig_char_table[x], m, getchar(x))
@@ -581,7 +581,7 @@ do
       local xf = getfont(x)
       local m = ltjf_font_metric_table[xf]
       local cls = slow_find_char_class(c, m, c_glyph)
-      setfield(x, 'char', ltjf_get_vert_glyph(xf, c_glyph) or c_glyph)
+      --setfield(x, 'char', ltjf_get_vert_glyph(xf, c_glyph) or c_glyph)
       Nx.met = m; Nx.class = cls;
       if cls~=0 then set_attr(x, attr_jchar_class, cls) end
       Nx.pre  = table_current_stack[PRE + c]  or 0
@@ -902,7 +902,7 @@ end
 local function handle_np_jachar(mode)
    local qid = Nq.id
    if qid==id_jglyph or ((qid==id_pbox or qid==id_pbox_w) and Nq.met) then
-      local g = non_ihb_flag and calc_ja_ja_glue() or get_kanjiskip() -- M->K
+       local g = non_ihb_flag and calc_ja_ja_glue() or get_kanjiskip() -- M->K
       handle_penalty_normal(Nq.post, Np.pre, g); real_insert(g)
    elseif Nq.met then  -- qid==id_hlist
       local g = non_ihb_flag and get_OA_skip() or get_kanjiskip() -- O_A->K
@@ -1173,11 +1173,6 @@ do
       if Np and Np.nuc then return Np
       elseif Np and getfield(lp, 'user_id') == BPAR then
          Np.first = lp; Np.nuc = lp; Np.last = lp
-         Np.char = 'parbdd'
-         Np.met = nil
-         Np.pre = 0; Np.post = 0
-         Np.xspc = 0
-         Np.auto_xspc = false
          return Np
       end
    end
@@ -1186,6 +1181,13 @@ do
        if not s and getfield(Nq.nuc, 'user_id') == BPAR then
          local x, y = node_prev(Nq.nuc), Nq.nuc
          Nq.first, Nq.nuc, Nq.last = x, x, x
+         if Np then
+            if Np.met then
+               Nq.class = fast_find_char_class('parbdd', Np.met)
+            end
+            Nq.met = Np.met; Nq.pre = 0; Nq.post = 0; Nq.xspc = 0
+            Nq.auto_xspc = false
+         end
          head = node_remove(head, y)
         node_free(y)
       end