summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexko
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-07 21:07:38 +0000
committerKarl Berry <karl@freefriends.org>2019-06-07 21:07:38 +0000
commit1d19d9c3f48cefb4553d0f598ea407d12e6614d7 (patch)
tree8aa74357977fd1fcf1cb1fd40e776f39171b8bb6 /Master/texmf-dist/tex/luatex/luatexko
parent01c5863069156c826b8b5c15312db454a51c2264 (diff)
luatexko (7jun19)
git-svn-id: svn://tug.org/texlive/trunk@51342 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua49
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty4
4 files changed, 38 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
index 0690a685c4d..d1429026fbe 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
@@ -13,8 +13,8 @@
luatexbase.provides_module({
name = "luatexko-normalize",
- version = "2.1",
- date = "2019/05/25",
+ version = "2.2",
+ date = "2019/06/07",
author = "Dohyun Kim, Soojin Nam",
description = "Hangul normalization",
license = "LPPL v1.3+",
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua
index af346161b8b..1757d5b7017 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua
@@ -13,8 +13,8 @@
luatexbase.provides_module({
name = "luatexko-uhc2utf8",
- version = "2.1",
- date = "2019/05/25",
+ version = "2.2",
+ date = "2019/06/07",
author = "Dohyun Kim, Soojin Nam",
description = "UHC (CP949) input encoding",
license = "LPPL v1.3+",
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
index 87478153ada..17b43d5628a 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 = '2019/05/25',
- version = '2.1',
+ date = '2019/06/07',
+ version = '2.2',
description = 'typesetting Korean with LuaTeX',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -52,10 +52,11 @@ local fontfonts = font.fonts
local fontgetfont = font.getfont
local getparameters = font.getparameters
-local texcount = tex.count
-local texround = tex.round
-local texset = tex.set
-local texsp = tex.sp
+local texcount = tex.count
+local texround = tex.round
+local texset = tex.set
+local texsp = tex.sp
+local texsprint = tex.sprint
local stringformat = string.format
@@ -183,7 +184,7 @@ local function is_hangul_jamo (c)
or c >= 0x3131 and c <= 0x318E
end
-local stretch_f, shrink_f = 5/100, 3/100 -- should be consistent for ruby
+local stretch_f = 5/100 -- should be consistent for ruby
local function get_font_data (fontid)
return fontgetfont(fontid) or fontfonts[fontid] or {}
@@ -275,11 +276,12 @@ luatexko.updateforcehangul = update_force_hangul
local active_processes = {}
local char_font_options = {
- interhangul = {},
- interlatincjk = {},
- intercharacter = {},
- hangulspaceskip = {},
- tonemarkwidth = {},
+ hangulspaceskip = {},
+ intercharacter = {},
+ intercharstretch = {},
+ interhangul = {},
+ interlatincjk = {},
+ tonemarkwidth = {},
}
local function hangul_space_skip (curr, newfont)
@@ -576,7 +578,7 @@ local function get_font_opt_dimen (fontid, optionname)
return dim
end
-local function insert_glue_before (head, curr, par, br, brb, classic, ict, dim)
+local function insert_glue_before (head, curr, par, br, brb, classic, ict, dim, fid)
local pn = nodenew(penaltyid)
if not br then
pn.penalty = 10000
@@ -590,12 +592,13 @@ local function insert_glue_before (head, curr, par, br, brb, classic, ict, dim)
dim = dim or 0
local gl = nodenew(glueid)
- local en = get_en_size(curr.font)
+ local en = get_en_size(fid)
if ict then
en = classic and en or en/4
setglue(gl, en * ict[1] + dim, nil, en * ict[2])
else
- setglue(gl, dim, en * stretch_f, en * shrink_f)
+ local str = get_font_opt_dimen(fid, "intercharstretch") or stretch_f*en
+ setglue(gl, dim, str, str*0.6)
end
head = insert_before(head, curr, pn)
@@ -610,7 +613,7 @@ local function maybe_linebreak (head, curr, pc, pcl, cc, old, fid, par)
local br = brb and breakable_after[pc]
local dim = get_font_opt_dimen(fid, "intercharacter")
if ict or br or dim and (pcl >= 1 or ccl >= 1) then
- head = insert_glue_before(head, curr, par, br, brb, old, ict, dim)
+ head = insert_glue_before(head, curr, par, br, brb, old, ict, dim, fid)
end
end
return head, cc, ccl
@@ -713,7 +716,7 @@ local function do_interhangul_option (head, curr, pc, c, fontid, par)
if cc*pc == 1 and curr.lang ~= nohyphen then
local dim = get_font_opt_dimen(fontid, "interhangul")
if dim then
- head = insert_glue_before(head, curr, par, true, true, false, false, dim)
+ head = insert_glue_before(head, curr, par, true, true, false, false, dim, fontid)
end
end
@@ -763,7 +766,7 @@ local function do_interlatincjk_option (head, curr, pc, pf, c, cf, par)
local fontid = cc == 1 and cf or pf
local dim = get_font_opt_dimen(fontid, "interlatincjk")
if dim then
- head = insert_glue_before(head, curr, par, true, brb, false, false, dim)
+ head = insert_glue_before(head, curr, par, true, brb, false, false, dim, fontid)
end
end
@@ -1134,6 +1137,16 @@ end
local rubybox = {}
luatexko.rubybox = rubybox
+local function getrubystretchfactor (box)
+ local _, fid = ruby_char_font(box)
+ local str = get_font_opt_dimen(fid, "intercharstretch")
+ if str then
+ local em = get_en_size(fid) * 2
+ texsprint(stringformat("\\def\\luatexkostretchfactor{%.4f}", str/em/2))
+ end
+end
+luatexko.getrubystretchfactor = getrubystretchfactor
+
local function process_ruby_pre_linebreak (head)
local curr = head
while curr do
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index bf151279768..8660fe8de54 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
@@ -13,7 +13,7 @@
\ifdefined\luatexkohangulfontattr \endinput\fi
\ifdefined\selectfont
- \ProvidesPackage{luatexko}[2019/05/25 v2.1 typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko}[2019/06/07 v2.2 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}
\else
@@ -190,6 +190,7 @@
#2}%
\hbadness\@M % supress underfull warning
\dimen@ii\dimexpr\rubysize em\relax % ruby font size
+ \directlua{ luatexko.getrubystretchfactor(tex.box[2]) }% for intercharstretch
\ifdim\wd\z@ < \wd\tw@ % ruby is wider
\ifruby@overlap
\dimen@\dimexpr\wd\tw@-\wd\z@-\dimen@ii\relax % overhang .5 rubysize
@@ -662,6 +663,7 @@
\newfontfeature{Expansion}{expansion=\ifx\empty#1\empty default\else #1\fi }
\newfontfeature{Protrusion}{protrusion=\ifx\empty#1\empty default\else #1\fi }
\newfontfeature{InterCharacter}{intercharacter=#1}
+\newfontfeature{InterCharStretch}{intercharstretch=#1}
% italic correction
\def\nocorrlist{,.^^^^3001^^^^3002^^^^ff0c^^^^ff0e^^^^ff61^^^^ff64}
% package options