- local q = nil -- the previous node of p
- local g
- local ihb_flag = false
- local inserted_after_penalty = false
- if not p then
- return head
- end
- while p and ltj.is_parindent_box(p) do p=next_node(p) end
- while p do
- if p.id==id_whatsit and p.subtype==node.subtype('user_defined')
- and p.user_id==30111 then
- g=p; p=next_node(p);
- ihb_flag=true; head,p=node.remove(head, g)
- else
- g=calc_between_two_jchar(q,p)
- if g and (not ihb_flag) then
- h = node_insert_before(head,p,g)
- if not q then head=h end
- -- If p is the first node (=head), the skip is inserted
- -- before head. So we must change head.
- end
- --if is_japanese_glyph_node(q) then
- -- node.insert(q, inserted_after_penalty)
- --end
- q=p; ihb_flag=false;
- if is_japanese_glyph_node(p)
- and add_kinsoku_penalty(head,p) then
- p=next_node(p); inserted_after_penalty = true
- else
- inserted_after_penalty = false
- end
- p=next_node(p)
- end
- end
- -- Insert skip after the last node
- g=calc_between_two_jchar(q,nil)
- if g then h = node_insert_after(head,q,g) end
- return head
-end
-
-
-
--- Insert \xkanjiskip at the boundaries between Japanese characters
--- and non-Japanese characters.
--- We also insert \kanjiskip between Kanji in this function.
-local kanji_skip={}
-local xkanji_skip={}
-local cx = nil
-local no_skip=0
-local after_schar=1
-local after_wchar=2
-local insert_skip=no_skip
-
-
--- In the next two function, cx is the Kanji code.
-local function insert_akxsp(head,q)
- if get_inhibit_xsp_table(cx)<=1 then return end
- local g = node_new(id_glue)
- g.subtype=0; g.spec=node.copy(xkanji_skip)
- node_insert_after(head,q,g)
-end
-
-local function insert_kaxsp(head,q,p)
- local g=true
- local c=p.char
- while p.components and p.subtype
- and math.floor(p.subtype/2)%2==1 do
- p=p.components; c = p.char
- end
- if get_inhibit_xsp_table(c)%2 == 1 then
- if get_inhibit_xsp_table(cx)%2==0 then g=false end
- else
- g=false
- end
- if g then
- g = node_new(id_glue)
- g.subtype=0; g.spec=node.copy(xkanji_skip)
- node_insert_after(head,q,g)
- end