OSDN Git Service

ltj-jfmglue.lua: \accent (forum: 2931)
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 20 Sep 2020 19:33:22 +0000 (04:33 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 20 Sep 2020 19:33:22 +0000 (04:33 +0900)
src/ltj-jfmglue.lua
test/test02-latex.pdf
test/test02-latex.tex

index 84249a7..b37b1ab 100644 (file)
@@ -178,7 +178,7 @@ local function check_box(box_ptr, box_end)
       local pid = getid(p)
       if pid==id_kern and getsubtype(p)==2 then
          p = node_next(node_next(node_next(p))); pid = getid(p) -- p must be glyph_node
-       end
+      end
       if pid==id_glyph then
          repeat
             if find_first_char then first_char = p; find_first_char = false end
@@ -268,7 +268,7 @@ local function check_next_ickern(lp)
    local lx = Np.nuc
    while lp and getid(lp) == id_kern and ( getsubtype(lp)==0 or 
      getsubtype(lp)==3 or ITALIC == get_attr_icflag(lp)) do
-     set_attr(lp, attr_icflag, IC_PROCESSED);
+     set_attr(lp, attr_icflag, IC_PROCESSED)
      lx, lp = lp, node_next(lp)
    end
    Np.last = lx; return lp
@@ -279,7 +279,7 @@ local function calc_np_pbox(lp, last)
    --local lpa = get_attr_icflag(lp)==PACKED and PACKED or KINSOKU -- KINSOKU: dummy
    local lpa = get_attr_icflag(lp)
    Np.first = Np.first or lp; Np.id = id_pbox
-   set_attr(lp, attr_icflag, get_attr_icflag(lp));
+   set_attr(lp, attr_icflag, get_attr_icflag(lp))
    while lp ~=last and (lpa>=PACKED) and (lpa<BOXBDD) do
       local lpi = getid(lp)
       if lpa==PACKED then
@@ -340,9 +340,9 @@ function calc_np_aux_glyph_common(lp, acc_flag)
       local y_adjust = has_attr(lp,attr_ablshift) or 0
       local node_depth = getfield(lp, 'depth') + min(y_adjust, 0)
       local adj_depth = (y_adjust>0) and (getfield(lp, 'depth') + y_adjust) or 0
-      setfield(lp, 'yoffset', getfield(lp, 'yoffset') - y_adjust)
-      lp = node_next(lp)
-      for lx in traverse(lp) do
+      setfield(lp, 'yoffset', getfield(lp, 'yoffset') - y_adjust); lp = node_next(lp)
+      local lx=lp
+      while lx do
          local lai = get_attr_icflag(lx)
          if lx==last or  lai>=PACKED then
             lp=lx; break
@@ -354,7 +354,7 @@ function calc_np_aux_glyph_common(lp, acc_flag)
                y_adjust = has_attr(lx,attr_ablshift) or 0
                node_depth = max(getfield(lx, 'depth') + min(y_adjust, 0), node_depth)
                adj_depth = (y_adjust>0) and max(getfield(lx, 'depth') + y_adjust, adj_depth) or adj_depth
-               setfield(lx, 'yoffset', getfield(lx, 'yoffset') - y_adjust)
+               setfield(lx, 'yoffset', getfield(lx, 'yoffset') - y_adjust); lx = node_next(lx)
             elseif lid==id_kern then
                local ls = getsubtype(lx)
                if ls==2 then -- アクセント用の kern
@@ -367,9 +367,9 @@ function calc_np_aux_glyph_common(lp, acc_flag)
                   end
                   lx = node_next(node_next(lx))
                elseif ls==0  then
-                  Np.last = lx
+                  Np.last = lx; lx = node_next(lx)
                elseif (ls==3) or (lai==ITALIC) then
-                  Np.last = lx; set_attr(lx, attr_icflag, IC_PROCESSED)
+                  Np.last = lx; set_attr(lx, attr_icflag, IC_PROCESSED); lx = node_next(lx)
                else
                   lp=lx; break
                end
@@ -1235,8 +1235,8 @@ end
 -- main interface
 function luatexja.jfmglue.main(ahead, mode, dir)
    if not ahead then return ahead end
-   --luatexja.ext_show_node_list(to_node(ahead ), '>B ', print)
-   --print()
+   -- luatexja.ext_show_node_list(node.direct.tonode(ahead ), '>B ', print)
+   -- print()
    head = ahead;
    local lp, last, par_indented, TEMP = init_var(mode,dir)
    lp = calc_np(last, lp)
index b9988b9..3964596 100644 (file)
Binary files a/test/test02-latex.pdf and b/test/test02-latex.pdf differ
index ccb446f..8b80bc5 100644 (file)
@@ -1,4 +1,5 @@
 %#! lualatex
+\directlua{luatexja_debug=1}
 \documentclass{ltjsarticle}
 %\nonstopmode
 
 \noindent{\Large ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}
 
 \noindent{\LARGE ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}
-%\end{document}
+
+
+\makeatletter
+RM {\rmfamily (\f@family, \k@family) XYZかきく}\par
+SF {\sffamily (\f@family, \k@family) XYZかきく}\par
+TT {\ttfamily (\f@family, \k@family) XYZかきく}\verb+あいうABC+\par
+
+\^{A}V\^{A}T\^{A}R
+
+\usefont{OT1}{cmr}{m}{n} \^{A}V\^{A}T\^{A}R
 
 \section{slanted, extended}
 \DeclareFontShape{JY3}{mc}{m}{sl}{<-> s*[0.962216] 
@@ -72,6 +82,8 @@
 
 {\fontfamily{gt}\fontseries{x}\selectfont あいう}
 
+\end{document}
+
 \paragraph{italic correction inserted by {\tt\char92text...}}\
 
 font series `ix': 欧文は未定義,和文は機械的斜体.
@@ -119,4 +131,15 @@ font series `ix': 欧文は未定義,和文は機械的斜体.
 あい{うえお\texttt{abc}\globaldefs1あ\/い}うえお
 
 あいうえお{\tt abc}あいうえお
+
+\paragraph{font definition file}
+
+{\fontfamily{afdtest}\selectfont abcあいう
+\fontfamily{kfdtest}\selectfont abcあいう}\par
+
+A
+\fontfamily{kfdtest}\selectfont abcあいう
+
+
+
 \end{document}