summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexko
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
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')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty58
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua43
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty2
3 files changed, 55 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
index bec7d1206b2..06e7e1e65a0 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
@@ -17,7 +17,7 @@
\ifcsname ifpdf\endcsname\else \input ifpdf.sty \fi
\catcode`@ = 11
\else
- \ProvidesPackage{luatexko-core}[2016/05/08 v1.14 Typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko-core}[2016/05/14 v1.15 Typesetting Korean with LuaTeX]
\RequirePackage{luaotfload}[2016/04/21]
\RequirePackage{ifpdf}
\fi
@@ -268,47 +268,51 @@
%% ulem doesn't work well with luatexko;
%% especially linebreak does not occur inside cjk words.
\def\ulinewidth{0.04em }
-\def\ulinedown {0.25em }
+\def\ulinedown {0.24em }
\newcount\luakoulineboxcnt\luakoulineboxcnt\z@
-\protected\def\uline#1{%
+\chardef\luako@uline@level\z@ % for nested uline
+\def\luako@nested@ulinedown{% must be used in a group
+ \ifcase\luako@uline@level\else
+ \edef\ulinedown{\the\dimexpr\ulinedown+0.1em\relax}%
+ \fi
+ \chardef\luako@uline@level\@ne}
+\def\luako@uline@code@common{%
\begingroup
\ifnum\luakoulineboxcnt > 65535 \luakoulineboxcnt\z@ \fi
\global\advance\luakoulineboxcnt\@ne
- \edef\luako@temp@{\the\luakoulineboxcnt}%
- \leavevmode
+ \count@\luakoulineboxcnt
+ \leavevmode}
+\protected\def\uline#1{%
+ \luako@uline@code@common
+ \luako@nested@ulinedown
\dimen@\dimexpr\ulinedown+\ulinewidth\relax
\dimen@ii-\dimexpr\ulinedown\relax
- \setbox\z@\hbox{\vrule width0pt height\dimen@ii depth\dimen@}%
- \directlua{ luatexko.ulinebox[\luako@temp@]=node.copy_list(tex.box[0].head)
- luatexko.uline_boundary(\luako@temp@,true) }%
+ \setbox\z@\hbox{\vrule width\z@ height\dimen@ii depth\dimen@}%
+ \directlua{ luatexko.uline_boundary(\the\count@,tex.box[0].head) }%
#1%
- \directlua{ luatexko.uline_boundary(\luako@temp@,false) }%
+ \directlua{ luatexko.uline_boundary(\the\count@) }%
\endgroup}
\protected\def\sout#1{{\def\ulinedown{-0.5ex-\ulinewidth/2}\uline{#1}}}
+\protected\def\uuline#1{\uline{\uline{#1}}}
% ulem with arbitray box
\protected\def\markoverwith#1#2{%
- \begingroup
- \ifnum\luakoulineboxcnt > 65535 \luakoulineboxcnt\z@ \fi
- \global\advance\luakoulineboxcnt\@ne
- \edef\luako@temp@{\the\luakoulineboxcnt}%
- \leavevmode
+ \luako@uline@code@common
\setbox\z@\hbox{#1}%
- \directlua{ luatexko.ulinebox[\luako@temp@]=node.copy_list(tex.box[0])
- luatexko.uline_boundary(\luako@temp@,true) }%
+ \directlua{ luatexko.uline_boundary(\the\count@,tex.box[0]) }%
#2%
- \directlua{ luatexko.uline_boundary(\luako@temp@,false) }%
+ \directlua{ luatexko.uline_boundary(\the\count@) }%
\endgroup}
-\protected\def\uuline{\dimen@ii-\dimexpr\ulinedown\relax
- \dimen@\dimexpr\ulinedown+\ulinewidth\relax
- \markoverwith{\vtop{\hrule width.1em height\dimen@ii depth\dimen@
- \kern.1em\hrule height\dimen@ii depth\dimen@}}}
-\protected\def\uwave {\ifx\ltxko@sixly\undefined \font\ltxko@sixly=lasy6 \fi
+\protected\def\uwave{\ifx\ltxko@sixly\undefined \font\ltxko@sixly=lasy6 \fi
\markoverwith{\lower4\p@\hbox{\ltxko@sixly\char58}}}
-\protected\def\xout {\markoverwith{\hbox to.35em{/\hss}}}
-\protected\def\dashuline{\markoverwith{\kern.125em\vtop{\kern\ulinedown
- \hrule width.3em height\z@ depth\ulinewidth}\kern.125em}}
-\protected\def\dotuline{\dimen@\dimexpr\ulinedown+0.1ex\relax
- \markoverwith{\lower\dimen@\hbox{\kern.1em .\kern.04em}}}
+\protected\def\xout {\markoverwith{\hbox to.35em{/\hss}}}
+\protected\def\dashuline#1{\begingroup
+ \luako@nested@ulinedown
+ \markoverwith{\kern.125em\vtop{\kern\ulinedown
+ \hrule width.3em height\z@ depth\ulinewidth}\kern.125em}{#1}\endgroup}
+\protected\def\dotuline#1{\begingroup
+ \luako@nested@ulinedown
+ \dimen@\dimexpr\ulinedown+0.1ex\relax
+ \markoverwith{\lower\dimen@\hbox{\kern.1em .\kern.04em}}{#1}\endgroup}
%% hangul font -- core
\def\luatexko@hangul@selectfont{%
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
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index 9101bbe65ac..d6a3a0dbe8f 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
@@ -23,7 +23,7 @@
\expandafter\endinput
\fi
-\ProvidesPackage{luatexko}[2016/05/08 v1.14 Typesetting Korean with LuaLaTeX]
+\ProvidesPackage{luatexko}[2016/05/14 v1.15 Typesetting Korean with LuaLaTeX]
\ifdefined\adjustspacing\else % luatex < 0.87
\let\adjustspacing\pdfadjustspacing