- end
- return 0
-end
-
--- procedures for \jfont command.
-function ltj.jfontdefA(b)
- ltj.fntbki=font.current()
- ltj.cstemp=token.csname_name(token.get_next())
- tex.sprint('\\csname ' .. ltj.cstemp .. '\\endcsname\\csname @jfont\\endcsname')
- -- A trick to get font id associated of the argument of \jfont.
- -- font.id() does not seem to work in my environment...
-end
-function ltj.jfontdefB(s) -- for horizontal font
- local j=ltj.search_metric(s)
- if not j then
- ltj.error("metric named '" .. s .. "' didn't loaded")
- return
- end
- local fn=font.current()
- local f = font.fonts[fn]
- ltj.font_metric_table[fn]={}
- ltj.font_metric_table[fn].jfm=j; ltj.font_metric_table[fn].size=f.size
- tex.sprint('\\expandafter\\def\\csname ' .. ltj.cstemp .. '\\endcsname'
- .. '{\\csname luatexja@curjfnt\\endcsname=' .. fn
- .. ' \\zw=' .. tex.round(f.size*ltj.metrics[j].zw) .. 'sp'
- .. '\\zh=' .. tex.round(f.size*ltj.metrics[j].zh) .. 'sp\\relax}')
- font.current(ltj.fntbki); ltj.fntbk = {}; ltj.cstemp = {}
-end
-
--- return true if and only if p is a Japanese character node
-function ltj.is_japanese_glyph_node(p)
- return p and (node.type(p.id)=='glyph')
- and (p.font==node.has_attribute(p,luatexbase.attributes['luatexja@curjfnt']))
-end
-
----------- Kinsoku
-----------
-ltj.penalty_table = {}
-function ltj.set_penalty_table(m,c,p)
- if not ltj.penalty_table[c] then ltj.penalty_table[c]={} end
- if m=='pre' then
- ltj.penalty_table[c].pre=p
- elseif m=='post' then
- ltj.penalty_table[c].post=p
- end
-end
-function ltj.get_penalty_table(m,c)
- local i=ltj.penalty_table[c]
- if i then
- i=(ltj.penalty_table[c])[m]
- end
- if not i then i=0 end
- tex.swrite(i)
-end
-
-ltj.inhibit_xsp_table = {}
-function ltj.set_inhibit_xsp_table(c,p)
- ltj.inhibit_xsp_table[c]=p
-end
-function ltj.get_inhibit_xsp_table(c,p)
- local i=ltj.inhibit_xsp_table[c]
- if not i then i=3 end
- tex.swrite(i)
-end
-
-----------
-----------
-function ltj.create_ihb_node()
- local g=node.new(node.id('whatsit'), node.subtype('user_defined'))
- g.user_id=30111; g.type=number; g.value=1
- node.write(g)
-end
-
--- The fullname field of virtual font expresses its metric
-function ltj.find_size_metric(px)
- if ltj.is_japanese_glyph_node(px) then
- return ltj.font_metric_table[px.font].size, ltj.font_metric_table[px.font].jfm