summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-14 22:11:33 +0000
committerKarl Berry <karl@freefriends.org>2016-05-14 22:11:33 +0000
commita250d691586dcb9dc789cd1c6b3a129ac4afc424 (patch)
tree38631e99016ad6201aec39a18aac75510e741487 /Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
parent7018dd6ace780dbf792b16f2c70294d5363db14c (diff)
luatexko (14may16)
git-svn-id: svn://tug.org/texlive/trunk@41128 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko/luatexko.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua43
1 files changed, 23 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
index 0be96ddbd0d..0888aec134a 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
@@ -13,8 +13,8 @@
luatexbase.provides_module {
name = 'luatexko',
- date = '2016/05/08',
- version = '1.14',
+ date = '2016/05/14',
+ version = '1.15',
description = 'Korean linebreaking and font-switching',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -23,10 +23,9 @@ luatexbase.provides_module {
luatexko = luatexko or {}
local luatexko = luatexko
-local dotemphnode,rubynode,ulinebox = {},{},{}
+local dotemphnode,rubynode = {},{}
luatexko.dotemphnode = dotemphnode
luatexko.rubynode = rubynode
-luatexko.ulinebox = ulinebox
local stringbyte = string.byte
local stringchar = string.char
@@ -52,6 +51,7 @@ local fallbackfntattr = luatexbase.attributes.fallbackfntattr
local hangulpunctsattr = luatexbase.attributes.hangulpunctsattr
local luakoglueattr = luatexbase.new_attribute("luakoglueattr")
local luakounicodeattr = luatexbase.new_attribute("luakounicodeattr")
+local luakoulineattr = luatexbase.new_attribute("luakoulineattr")
local function warn (...)
return luatexbase.module_warning("luatexko", stringformat(...))
@@ -84,6 +84,7 @@ local penaltynode = node.id("penalty")
local rulenode = node.id("rule")
local whatsitnode = node.id("whatsit")
local user_whatsit = node.subtype("user_defined")
+local n_copy_list = node.copy_list
local nodedirect = node.direct
local d_todirect = nodedirect.todirect
@@ -1487,6 +1488,7 @@ local function nanumtype1font(curr)
local currchar, currfont = d_getchar(curr), d_getfont(curr)
if currchar > 0xFFFF then return end
local fnt_t = get_font_table(currfont)
+ if not fnt_t then return end
local family = (d_has_attribute(curr,finemathattr) or 0) > 1 and not is_hanja(currchar) and "nanummj" or "nanumgt"
local series = fnt_t.shared and
fnt_t.shared.rawdata and
@@ -1812,11 +1814,12 @@ end
local uline_start_id = luatexbase.new_whatsit("luako_uline_start")
local uline_stop_id = luatexbase.new_whatsit("luako_uline_stop")
-local function uline_boundary (num, start)
- local n = d_nodenew(whatsitnode, user_whatsit) -- todo: use node list
- d_setfield(n, "user_id", start and uline_start_id or uline_stop_id)
- d_setfield(n, "type", 100)
- d_setfield(n, "value", num)
+local function uline_boundary (num, list)
+ local n = d_nodenew(whatsitnode, user_whatsit)
+ d_setfield(n, "user_id", list and uline_start_id or uline_stop_id)
+ d_setfield(n, "type", 110) -- node list
+ d_setfield(n, "value", n_copy_list(list))
+ d_set_attribute(n, luakoulineattr, num)
d_nodewrite(n)
end
luatexko.uline_boundary = uline_boundary
@@ -1852,17 +1855,17 @@ local function after_linebreak_underline(head,glueorder,glueset,gluesign,ulstart
level+1)
d_setlist(curr, newhead)
elseif currid == whatsitnode and d_getsubtype(curr) == user_whatsit then
- local user_id = d_getfield(curr, "user_id")
+ local attr = d_has_attribute(curr, luakoulineattr)
local whatsit_type = d_getfield(curr, "type")
- local num = d_getfield(curr, "value")
- if num and ulinebox[num] and whatsit_type == 100 then
+ if attr and whatsit_type == 110 then
+ local user_id = d_getfield(curr, "user_id")
if user_id == uline_start_id then
- ulstart[num] = { start = curr, level = level }
- elseif user_id == uline_stop_id and ulstart[num] then
- local ubox = d_todirect(ulinebox[num])
- head = draw_underline(head,curr,glueset,gluesign,glueorder,ubox,ulstart[num].start)
- d_nodefree(ubox)
- ulinebox[num], ulstart[num] = nil, nil
+ local list = d_getfield(curr, "value")
+ ulstart[attr] = { start = curr, list = list, level = level }
+ elseif user_id == uline_stop_id and ulstart[attr] then
+ local ubox, start = ulstart[attr].list, ulstart[attr].start
+ head = draw_underline(head,curr,glueset,gluesign,glueorder,ubox,start)
+ ulstart[attr] = nil
end
end
end
@@ -1870,9 +1873,9 @@ local function after_linebreak_underline(head,glueorder,glueset,gluesign,ulstart
local curr = d_nodetail(head)
for i, v in pairs(ulstart) do
- local ubox = d_todirect(ulinebox[i])
+ local ubox, start = v.list, v.start
if ubox and level == v.level then
- head = draw_underline(head,curr,glueset,gluesign,glueorder,ubox,v.start)
+ head = draw_underline(head,curr,glueset,gluesign,glueorder,ubox,start)
ulstart[i].start = nil
end
end