• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ソースコードの管理場所


Commit MetaInfo

修订版cd47cbb8581fedb03c2f9b7cb1607b68c858a2a0 (tree)
时间2015-10-12 08:00:46
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Log Message

small optimize

更改概述

差异

--- a/doc/luatexja.dtx
+++ b/doc/luatexja.dtx
@@ -24,6 +24,7 @@
2424 %%%%%%%% fonts
2525 \usepackage{luatexja-otf}
2626 \directlua{luatexja.otf.enable_ivs()}
27+\expandafter\let\csname xetex_suppressfontnotfounderror:D\endcsname\suppressfontnotfounderror
2728 \usepackage[match]{luatexja-fontspec}
2829 \usepackage[kozuka-pr6n]{luatexja-preset}
2930 \usepackage{unicode-math}
@@ -5051,7 +5052,7 @@ This callback is called when \LuaTeX-ja is trying to encapsule a
50515052 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
50525053 %</ja>
50535054 \begin{lstlisting}[numbers=left]
5054-function (<table> shift_info, <table> jfont_info, <number> char_class)
5055+function (<table> shift_info, <table> jfont_info, <table> char_type)
50555056 return <table> new_shift_info
50565057 end
50575058 \end{lstlisting}
@@ -5090,7 +5091,7 @@ Then, the position of glyphs is shifted up by
50905091 (和文OpenTypeフォントの標準値)
50915092 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
50925093 \end{itemize}
5093-となっていたとする.すると,実際の文字の出力位置は,以下の量だけ上にぜらされることとなる:
5094+となっていたとする.すると,実際の文字の出力位置は,以下の量だけ上にずらされることとなる:
50945095 %</ja>
50955096 \[
50965097 \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
--- a/src/ltj-jfmglue.lua
+++ b/src/ltj-jfmglue.lua
@@ -319,9 +319,9 @@ local function calc_np_aux_glyph_common(lp)
319319 Np.first= (Np.first or lp)
320320 if getfield(lp, 'lang') == lang_ja then
321321 Np.id = id_jglyph
322- local m, cls = set_np_xspc_jachar(Np, lp)
322+ local m, mc, cls = set_np_xspc_jachar(Np, lp)
323323 local npi, npf
324- lp, head, npi, npf = capsule_glyph(lp, m, cls, head, tex_dir, lp)
324+ lp, head, npi, npf = capsule_glyph(lp, m, mc[cls], head, tex_dir)
325325 Np.first = (Np.first~=Np.nuc) and Np.first or npf or npi
326326 Np.nuc = npi
327327 return true, check_next_ickern(lp);
@@ -567,6 +567,7 @@ do
567567 c = c or c_glyph
568568 local cls = slow_find_char_class(c, m, c_glyph)
569569 Nx.met, Nx.class, Nx.char = m, cls, c;
570+ local mc = m.char_type; Nx.char_type = mc
570571 if cls~=0 then set_attr(x, attr_jchar_class, cls) end
571572 if c~=c_glyph then set_attr(x, attr_jchar_code, c) end
572573 Nx.pre = table_current_stack[PRE + c] or 0
@@ -574,12 +575,13 @@ do
574575 Nx.xspc = table_current_stack[XSP + c] or 3
575576 Nx.kcat = table_current_stack[KCAT + c] or 0
576577 Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1)
577- return m, cls
578+ return m, mc, cls
578579 end
579580 function set_np_xspc_jachar_hbox(Nx, x)
580581 local m = ltjf_font_metric_table[getfont(x)]
581582 local c = has_attr(x, attr_jchar_code) or getchar(x)
582583 Nx.met, Nx.char = m, c; Nx.class = has_attr(x, attr_jchar_class) or 0;
584+ local mc = m.char_type; Nx.char_type = mc
583585 Nx.pre = table_current_stack[PRE + c] or 0
584586 Nx.post = table_current_stack[POST + c] or 0
585587 Nx.xspc = table_current_stack[XSP + c] or 3
@@ -682,9 +684,9 @@ local function handle_penalty_suppress(post, pre, g)
682684 end
683685
684686 -- 和文文字間の JFM glue を node 化
685-local function new_jfm_glue(m, bc, ac)
687+local function new_jfm_glue(mc, bc, ac)
686688 -- bc, ac: char classes
687- local g = m.char_type[bc][ac]
689+ local g = mc[bc][ac]
688690 if g then
689691 if g[1] then
690692 local f = node_new(id_glue)
@@ -832,23 +834,24 @@ do
832834
833835 calc_ja_ja_glue = function ()
834836 local qm, pm = Nq.met, Np.met
835- if (qm.char_type==pm.char_type) and (qm.var==pm.var) then
836- local g, _, kn, kp, kh = new_jfm_glue(qm, Nq.class, Np.class)
837+ local qmc, pmc = qm.char_type, pm.char_type
838+ if (qmc==pmc) and (qm.var==pm.var) then
839+ local g, _, kn, kp, kh = new_jfm_glue(qmc, Nq.class, Np.class)
837840 return g, (Np.auto_kspc or Nq.auto_kspc) and get_kanjiskip_low(false, qm, kn, kp, kh)
838841 else
839842 local npn, nqn = Np.nuc, Nq.nuc
840843 local gb, db, bn, bp, bh
841- = new_jfm_glue(qm, Nq.class,
844+ = new_jfm_glue(qmc, Nq.class,
842845 slow_find_char_class(Np.char,
843846 qm, getchar(npn)))
844847 local ga, da, an, ap, ah
845- = new_jfm_glue(pm,
848+ = new_jfm_glue(pmc,
846849 slow_find_char_class(Nq.char,
847850 pm, getchar(nqn)),
848851 Np.class)
849852 local g = calc_ja_ja_aux(gb, ga, db, da)
850853 local k
851- if (pm.char_type==qm.char_type) and (qm.var==pm.var) then
854+ if (pmc==qmc) and (qm.var==pm.var) then
852855 gb = get_kanjiskip_low(false, qm, bn, bp, bh)
853856 ga = get_kanjiskip_low(false, pm, an, ap, ah)
854857 k = calc_ja_ja_aux(gb, ga, db, da)
@@ -913,7 +916,7 @@ end
913916 local function get_OA_skip(is_kanji)
914917 local pm = Np.met
915918 local g, _, kn, kp, kh = new_jfm_glue(
916- pm,
919+ pm.char_type,
917920 fast_find_char_class((Nq.id == id_math and -1 or 'jcharbdd'), pm),
918921 Np.class)
919922 local k
@@ -928,7 +931,7 @@ end
928931 local function get_OB_skip(is_kanji)
929932 local qm = Nq.met
930933 local g, _, kn, kp, kh = new_jfm_glue(
931- qm, Nq.class,
934+ qm.char_type, Nq.class,
932935 fast_find_char_class((Np.id == id_math and -1 or'jcharbdd'), qm))
933936 local k
934937 if is_kanji==0 then
@@ -1051,7 +1054,7 @@ local function handle_list_tail(mode)
10511054 -- the current list is the contents of a hbox
10521055 local npi, pm = Np.id, Np.met
10531056 if npi == id_jglyph or (npi==id_pbox and pm) then
1054- local g = new_jfm_glue(pm, Np.class, fast_find_char_class('boxbdd', pm))
1057+ local g = new_jfm_glue(pm.char_type, Np.class, fast_find_char_class('boxbdd', pm))
10551058 if g then
10561059 set_attr(g, attr_icflag, BOXBDD)
10571060 head = insert_after(head, Np.last, g)
@@ -1065,7 +1068,7 @@ local function handle_list_head(par_indented)
10651068 local npi, pm = Np.id, Np.met
10661069 if npi == id_jglyph or (npi==id_pbox and pm) then
10671070 if non_ihb_flag then
1068- local g = new_jfm_glue(pm, fast_find_char_class(par_indented, pm), Np.class)
1071+ local g = new_jfm_glue(pm.char_type, fast_find_char_class(par_indented, pm), Np.class)
10691072 if g then
10701073 set_attr(g, attr_icflag, BOXBDD)
10711074 if getid(g)==id_glue and #Bp==0 then
--- a/src/ltj-math.lua
+++ b/src/ltj-math.lua
@@ -152,7 +152,7 @@ function (p, sty)
152152 set_attr(r, attr_ykblshift, 0)
153153 -- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避
154154 local met = ltjf_font_metric_table[f]
155- r = capsule_glyph_math(r, met, ltjf_find_char_class(pc, met));
155+ r = capsule_glyph_math(r, met, met.char_type[ltjf_find_char_class(pc, met)]);
156156 setfield(q, 'head', r); node_free(p); p=q;
157157 set_attr(r, attr_yablshift, k)
158158 end
--- a/src/ltj-setwidth.lua
+++ b/src/ltj-setwidth.lua
@@ -65,7 +65,7 @@ local ltjw = {} --export
6565 luatexja.setwidth = ltjw
6666
6767 luatexbase.create_callback("luatexja.set_width", "data",
68- function (fstable, fmtable, jchar_class)
68+ function (fstable, fmtable, char_data)
6969 return fstable
7070 end)
7171 local call_callback = luatexbase.call_callback
@@ -75,14 +75,13 @@ local fshift = { down = 0, left = 0}
7575 local min, max = math.min, math.max
7676
7777 -- 和文文字の位置補正(横)
78-local function capsule_glyph_yoko(p, met, class, head, dir)
79- local char_data = met.char_type[class]
78+local function capsule_glyph_yoko(p, met, char_data, head, dir)
8079 if not char_data then return node_next(p), head, p end
8180 -- f*: whd specified in JFM
8281 local fwidth, pwidth = char_data.width, getfield(p, 'width')
8382 fwidth = (fwidth ~= 'prop') and fwidth or pwidth
8483 fshift.down = char_data.down; fshift.left = char_data.left
85- fshift = call_callback("luatexja.set_width", fshift, met, class)
84+ fshift = call_callback("luatexja.set_width", fshift, met, char_data)
8685 local fheight, fdepth = char_data.height, char_data.depth
8786 local kbl = has_attr(p, attr_ykblshift) or 0
8887 --
@@ -133,8 +132,7 @@ end
133132 luatexja.setwidth.capsule_glyph_yoko = capsule_glyph_yoko
134133
135134 -- 和文文字の位置補正(縦)
136-local function capsule_glyph_tate(p, met, class, head, dir)
137- local char_data = met.char_type[class]
135+local function capsule_glyph_tate(p, met, char_data, head, dir)
138136 if not char_data then return node_next(p), head end
139137 local ascent, descent = met.ascent, met.descent
140138 local fwidth, pwidth = char_data.width
@@ -150,7 +148,7 @@ local function capsule_glyph_tate(p, met, class, head, dir)
150148 end
151149 fwidth = (fwidth ~= 'prop') and fwidth or pwidth
152150 fshift.down = char_data.down; fshift.left = char_data.left
153- fshift = call_callback("luatexja.set_width", fshift, met, class)
151+ fshift = call_callback("luatexja.set_width", fshift, met, char_data)
154152 local fheight, fdepth = char_data.height, char_data.depth
155153
156154 local y_shift
@@ -186,16 +184,15 @@ local function capsule_glyph_tate(p, met, class, head, dir)
186184 end
187185 luatexja.setwidth.capsule_glyph_tate = capsule_glyph_tate
188186
189-local function capsule_glyph_math(p, met, class)
190- local char_data = met.char_type[class]
187+local function capsule_glyph_math(p, met, char_data)
191188 if not char_data then return nil end
192189 local fwidth, pwidth = char_data.width, getfield(p, 'width')
193190 fwidth = (fwidth ~= 'prop') and fwidth or pwidth
194191 fshift.down = char_data.down; fshift.left = char_data.left
195- fshift = call_callback("luatexja.set_width", fshift, met, class)
192+ fshift = call_callback("luatexja.set_width", fshift, met, char_data)
196193 local fheight, fdepth = char_data.height, char_data.depth
197- local y_shift, ca
198- = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0), char_data.align
194+ local y_shift
195+ = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0)
199196 setfield(p, 'yoffset', -fshift.down)
200197 setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth) - fshift.left)
201198 local box = node_new(id_hlist);
--- a/src/luatexja.lua
+++ b/src/luatexja.lua
@@ -1,5 +1,6 @@
11
22 require('lualibs')
3+tableunpack = table.unpack
34
45 ------------------------------------------------------------------------
56 -- naming: