summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/ChangeLog7
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/README2
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdfbin283439 -> 288860 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex76
-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.lua347
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty6
8 files changed, 289 insertions, 157 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
index a4c035982ca..38e815ea960 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
+++ b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
@@ -1,3 +1,10 @@
+2019-08-01 Dohyun Kim <nomos at ktug org>
+
+ Version 2.4
+
+ * luatexko.lua: allow linebreak before/after a normal hbox
+ * luatexko.{sty,lua}: moveleft horizontal box inside vertical writing
+
2019-06-21 Dohyun Kim <nomos at ktug org>
Version 2.3
diff --git a/Master/texmf-dist/doc/luatex/luatexko/README b/Master/texmf-dist/doc/luatex/luatexko/README
index b83a164f5bf..1284ed2271e 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/README
+++ b/Master/texmf-dist/doc/luatex/luatexko/README
@@ -1,4 +1,4 @@
-LuaTeX-ko Package version 2.3 (2019/06/21)
+LuaTeX-ko Package version 2.4 (2019/08/01)
===========================================
This is a Lua(La)TeX macro package that supports typesetting Korean
diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
index e42c173b792..0eb5a5078fc 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
index faa88eeeaa8..517fe4d2ed4 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
+++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
@@ -12,6 +12,25 @@
\usepackage[hmargin=3.8cm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[hangul]{luatexko}
+\directlua{
+ fonts.protrusions.setups.notoserifcjk = {
+ [171] = { 0.5, 0 },
+ [187] = { 0, 0.5 },
+ [1002965] = { 0, 0.5 },
+ [1002968] = { 0.5, 0 },
+ [1002969] = { 0, 0.5 },
+ [1002970] = { 0, 1 },
+ [1002971] = { 0, 0.5 },
+ [1002972] = { 0, 1 },
+ [1002974] = { 0, 0.5 },
+ [1002975] = { 0, 0.5 },
+ [1002976] = { 0, 0.5 },
+ [1002985] = { 1, 0 },
+ [1002986] = { 0, 1 },
+ [1002988] = { 0.5, 0 },
+ [1002989] = { 0, 0.5 },
+ }
+}
\setmainhangulfont{Noto Serif CJK KR}[
Scale=0.98,
AutoFakeSlant,
@@ -21,7 +40,7 @@
UprightFont=* Light,
BoldFont=* Bold,
InterLatinCJK=.125em,
- Expansion, Protrusion,
+ Expansion, Protrusion=notoserifcjk,
]
\setsanshangulfont{Noto Sans CJK KR}[
Scale=0.98,
@@ -77,7 +96,7 @@
\author{Dohyun Kim \normalsize |<nomos at ktug org>| \and
Soojin Nam \normalsize |<jsunam at gmail com>| \and
\normalsize <\url{http://github.com/dohyunkim/luatexko}>}
-\date{Version 2.3\quad 2019/06/21}
+\date{Version 2.4\quad 2019/08/01}
\maketitle
\begin{quote}\small
@@ -334,10 +353,7 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 있
\section{고문헌}\label{sec:classic}
-\begin{figure}
- \centering
- \fbox{\parbox{37em}{\typesetclassic\sffamily
- \addhangulfontfeature{CompressPunctuations}
+\def\analectstext{%
子曰:「學而時習之,不亦說乎?有朋自遠方來,不亦樂乎?人不知而不慍,
不亦君子乎?」\par
有子曰:「其爲人也孝弟,而好犯上者,鮮矣!不好犯上,而好作亂者,未之有也!
@@ -347,6 +363,12 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 있
不習乎?」\par
子曰:「道千乘之國,敬事而信,節用而愛人,使民以時。」\par
子曰:「弟子入則孝,出則弟;謹而信,汎愛衆;而親仁,行有餘力,則以學文。」
+}
+\begin{figure}
+ \centering
+ \fbox{\parbox{37em}{\typesetclassic\sffamily
+ \addhangulfontfeature{CompressPunctuations}
+ \analectstext
}}
\caption{고문헌 조판 보기. typesetclassic 환경을 이용했다.}\label{fig:gomun}
\end{figure}
@@ -391,7 +413,7 @@ v2.0부터는 고문헌 조판에서 한글^^b7한자와 영문자가 붙어 나
기본으로 셋팅되어 있다. 일종의 고문헌 조판으로 보는 것이다.
\begin{figure}
-\framebox[\linewidth]{\begin{vertical}{20em}\sffamily
+\framebox[\linewidth]{\begin{vertical}{19.6em}\sffamily
\addhangulfontfeature{Vertical=Alternates, RawFeature=vertical}
\linespread{1.5}\selectfont
\hunmintxt
@@ -399,14 +421,39 @@ v2.0부터는 고문헌 조판에서 한글^^b7한자와 영문자가 붙어 나
\caption{세로쓰기의 예. 박스 높이 |20em|을 지시했다.}\label{fig:vertical}
\end{figure}
+\begin{figure}
+\framebox[\linewidth]{\begin{vertical}{18.62em}\sffamily
+ \addhangulfontfeature{Vertical=Alternates, RemoveClassicSpaces,
+ InterCharStretch=1pt, CompressPunctuations, RawFeature=vertical}
+ \linespread{1.5}\selectfont
+ \analectstext
+\end{vertical}}
+\caption{세로쓰기의 다른 예. 박스 높이 |19em|을 지시했다.
+ 글꼴옵션으로 |RemoveClassicSpaces|, |CompressPunctuations|와 더불어
+ |InterCharStretch=1pt|를 추가했다. 공백이 없는 문서는 자간늘이기 값을
+ 넉넉하게 주는 것이 좋다.}\label{fig:vertical3}
+\end{figure}
+
문서의 일부를 세로쓰기하려면 \cs{begin{vertical}{<dimen>}} \ldots\ \cs{end{vertical}}
환경을 이용한다. |<dimen>|으로 세로쓰기 박스의 높이를 지시한다.%
\footnote{%
플레인텍에서는 \cs{vertical{<dimen>}} \ldots\ \cs{endvertical}. }
-그림~\ref{fig:vertical} 및 그림~\ref{fig:vertical2} 참조.
+그림~\ref{fig:vertical},~\ref{fig:vertical3} 및 \ref{fig:vertical2} 참조.
+
+문서 전체를 세로쓰기한다면 이 환경을 쓰는 대신
+\cs{verticaltypesetting} 명령을 전처리부에 선언한다.
+이때 면주는 가로로 식자되며 면주 폰트의 설정은 사용자의 몫이다.
+
+세로쓰기 도중에 문서의 일부를 가로쓰기하려면
+\cs{begin{horizontal}{<dimen>}} \ldots\ \cs{end{horizontal}}
+환경을 이용한다. |<dimen>|은 가로쓰기 박스의 너비를 지시한다.%
+\footnote{%
+ 플레인텍에서는 \cs{horizontal{<dimen>}} \ldots\ \cs{endhorizontal}. }
+가로쓰기 영역의 폰트 설정은 사용자의 몫이다.%
+\footnote{폰트 지시는 |horizontal| 환경 안에서 행하는 것을 권장한다.}
\begin{figure}
-\framebox[\linewidth]{\begin{vertical}{17em}\sffamily
+\framebox[\linewidth]{\begin{vertical}{16.66em}\sffamily
\addhangulfontfeature{Vertical=Alternates, CharRaise=3.2pt,
CompressPunctuations, CharacterWidth=Full, RawFeature=vertical}
\parindent-1em\leftskip1em \linespread{1.5}\selectfont
@@ -431,17 +478,6 @@ v2.0부터는 고문헌 조판에서 한글^^b7한자와 영문자가 붙어 나
반각 크기로 강제했다.}\label{fig:vertical2}
\end{figure}
-문서 전체를 세로쓰기한다면 이 환경을 쓰는 대신
-\cs{verticaltypesetting} 명령을 전처리부에 선언한다.
-이때 면주는 가로로 식자되며 면주 폰트의 설정은 사용자의 몫이다.
-
-세로쓰기 도중에 문서의 일부를 가로쓰기하려면
-\cs{begin{horizontal}{<dimen>}} \ldots\ \cs{end{horizontal}}
-환경을 이용한다. |<dimen>|은 가로쓰기 박스의 너비를 지시한다.%
-\footnote{%
- 플레인텍에서는 \cs{horizontal{<dimen>}} \ldots\ \cs{endhorizontal}. }
-가로쓰기 영역의 폰트 설정은 사용자의 몫이다.
-
\section{드러냄표}\label{sec:dotemph}
\cs{dotemph} 명령으로 \dotemph{드러냄표}%
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
index 9213f4c3e1b..97c2b0ccf87 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.3",
- date = "2019/06/21",
+ version = "2.4",
+ date = "2019/08/01",
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 a26f6212383..82d11379cb5 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.3",
- date = "2019/06/21",
+ version = "2.4",
+ date = "2019/08/01",
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 5f6cd602e53..3ab4f18961a 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/06/21',
- version = '2.3',
+ date = '2019/08/01',
+ version = '2.4',
description = 'typesetting Korean with LuaTeX',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -52,11 +52,12 @@ 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 texsprint = tex.sprint
+local texattribute = tex.attribute
+local texcount = tex.count
+local texset = tex.set
+local texsp = tex.sp
+
+local set_macro = token.set_macro
local stringformat = string.format
@@ -142,6 +143,10 @@ local hangul_tonemark = {
[0x302E] = true, [0x302F] = true,
}
+local function is_compat_jamo (c)
+ return c >= 0x3131 and c <= 0x318E
+end
+
local function is_unicode_var_sel (c)
return c >= 0xFE00 and c <= 0xFE0F
or c >= 0xE0100 and c <= 0xE01EF
@@ -180,10 +185,10 @@ end
local function is_hangul_jamo (c)
return is_hangul(c)
+ or is_compat_jamo(c)
or is_chosong(c)
or is_jungsong(c)
or is_jongsong(c)
- or c >= 0x3131 and c <= 0x318E
end
local stretch_f = 5/100 -- should be consistent for ruby
@@ -306,7 +311,7 @@ local function hangul_space_skip (curr, newfont)
newsp = nodes.simple_font_handler(newsp)
newwd = newsp and newsp.width or false
if newwd then
- newwd = { texround(newwd), texround(newwd/2), texround(newwd/3) }
+ newwd = { texsp(newwd), texsp(newwd/2), texsp(newwd/3) }
end
char_font_options.hangulspaceskip[newfont] = newwd
if newsp then
@@ -337,13 +342,22 @@ local function process_fonts (head)
hangul_space_skip(curr, p.font)
curr.font = p.font
end
+
+ if not active_processes.reorderTM and
+ hangul_tonemark[c] and
+ option_in_font(curr.font, "script") == "hang" then
+ luatexko.activate("reorderTM") -- activate reorderTM here
+ active_processes.reorderTM = true
+ end
+
else
local hf = has_attribute(curr, hangulfontattr) or false
local hjf = has_attribute(curr, hanjafontattr) or false
- local fontdata = get_font_data(curr.font)
- local format = fontdata.format
- local no_legacy = format == "opentype" or format == "truetype"
- if hf and no_legacy and force_hangul[c] and curr.lang ~= nohyphen then
+ local fontdata = get_font_data(curr.font)
+ local format = fontdata.format
+ local encode = fontdata.encodingbytes
+ local widefont = encode == 2 or format == "opentype" or format == "truetype"
+ if hf and widefont and force_hangul[c] and curr.lang ~= nohyphen then
curr.font = hf
elseif hf and luatexko.hangulbyhangulfont and is_hangul_jamo(c) then
hangul_space_skip(curr, hf)
@@ -363,13 +377,6 @@ local function process_fonts (head)
end
end
- if not active_processes.reorderTM
- and hangul_tonemark[c]
- and option_in_font(curr.font, "script") == "hang" then
- luatexko.activate("reorderTM") -- activate reorderTM here
- active_processes.reorderTM = true
- end
-
props.unicode = c
end
elseif id == discid then
@@ -469,11 +476,11 @@ local breakable_after = setmetatable({
[0xFF1E] = true, [0xFF5E] = true, [0xFF70] = true,
},{ __index = function (_,c)
return is_hangul_jamo(c) and not is_chosong(c)
- or is_noncjk_char(c)
- or is_hanja(c)
- or is_cjk_combining(c)
- or is_kana(c)
- or charclass[c] >= 2
+ or is_noncjk_char(c)
+ or is_hanja(c)
+ or is_cjk_combining(c)
+ or is_kana(c)
+ or charclass[c] >= 2
end })
luatexko.breakableafter = breakable_after
@@ -498,10 +505,12 @@ local breakable_before = setmetatable({
[0xFF6F] = 1000, [0x1B150] = 1000, [0x1B151] = 1000, [0x1B152] = 1000,
[0x1B164] = 1000, [0x1B165] = 1000, [0x1B166] = 1000, [0x1B167] = 1000,
},{ __index = function(_,c)
- return is_hangul_jamo(c) and not is_jungsong(c) and not is_jongsong(c)
- or is_hanja(c)
- or is_kana(c)
- or charclass[c] == 1
+ return is_hangul(c)
+ or is_compat_jamo(c)
+ or is_chosong(c)
+ or is_hanja(c)
+ or is_kana(c)
+ or charclass[c] == 1
end
})
luatexko.breakablebefore = breakable_before
@@ -521,14 +530,50 @@ local function is_blocking_node (curr)
end
local function ruby_char_font (rb)
- local n, c, f = has_glyph(rb.list), 0, 0
+ local n = has_glyph(rb.list)
if n then
- c, f = my_node_props(n).unicode or n.char, n.font or 0
+ local c, f = my_node_props(n).unicode or n.char, n.font
if is_chosong(c) or hangul_tonemark[c] then
c = 0xAC00
end
+ return c, f
+ end
+end
+
+local function hbox_ini_char_font (box)
+ local curr = box.list
+ while curr do
+ local id = curr.id
+ if id == glyphid then
+ local c = my_node_props(curr).unicode or curr.char
+ if c and not is_cjk_combining(c) then
+ return c, curr.font
+ end
+ elseif id == hlistid and curr.list then
+ return hbox_ini_char_font(curr)
+ elseif is_blocking_node(curr) then
+ return
+ end
+ curr = getnext(curr)
+ end
+end
+
+local function hbox_fin_char_font (box)
+ local curr = nodeslide(box.list)
+ while curr do
+ local id = curr.id
+ if id == glyphid then
+ local c = my_node_props(curr).unicode or curr.char
+ if c and not is_cjk_combining(c) then
+ return c, curr.font
+ end
+ elseif id == hlistid and curr.list then
+ return hbox_fin_char_font(curr)
+ elseif is_blocking_node(curr) then
+ return
+ end
+ curr = getprev(curr)
end
- return c, f
end
local function get_actualtext (curr)
@@ -626,20 +671,35 @@ local function process_linebreak (head, par)
while curr do
local id = curr.id
if id == glyphid then
- local cc = my_node_props(curr).unicode or curr.char
- local old = has_attribute(curr, classicattr)
- head, pc, pcl = maybe_linebreak(head, curr, pc, pcl, cc, old, curr.font, par)
+ local c = my_node_props(curr).unicode or curr.char
+ if c and not is_unicode_var_sel(c) then
+ local old = has_attribute(curr, classicattr)
+ head, pc, pcl = maybe_linebreak(head, curr, pc, pcl, c, old, curr.font, par)
+ end
- elseif id == hlistid and has_attribute(curr, rubyattr) then
- local cc, fi = ruby_char_font(curr) -- rubybase
+ elseif id == hlistid and curr.list then
local old = has_attribute(curr, classicattr)
- head, pc, pcl = maybe_linebreak(head, curr, pc, pcl, cc, old, fi, par)
+ if has_attribute(curr, rubyattr) then
+ local c, f = ruby_char_font(curr) -- rubybase
+ if c and f then
+ head, pc, pcl = maybe_linebreak(head, curr, pc, pcl, c, old, f, par)
+ else
+ pc, pcl = false, 0
+ end
+ else
+ local c, f = hbox_ini_char_font(curr)
+ if c and f then
+ head = maybe_linebreak(head, curr, pc, pcl, c, old, f, par)
+ end
+ pc = hbox_fin_char_font(curr)
+ pcl = pc and get_char_class(pc, old) or 0
+ end
elseif id == whatsitid and curr.mode == directmode then
- local glyf, cc, fin = get_actualtext(curr)
- if cc and fin and glyf then
+ local glyf, c, fin = get_actualtext(curr)
+ if c and fin and glyf then
local old = has_attribute(glyf, classicattr)
- head = maybe_linebreak(head, curr, pc, pcl, cc, old, glyf.font, par)
+ head = maybe_linebreak(head, curr, pc, pcl, c, old, glyf.font, par)
pc, pcl, curr = fin, 0, goto_end_actualtext(curr)
end
@@ -712,34 +772,8 @@ local function is_cjk_char (c)
or rawget(breakable_after, c) and c >= 0x2000
end
-local function is_cjk (n, c) -- node, char
- if n and c then
- if is_unicode_var_sel(c) then
- local p = getprev(n)
- if p and p.id == glyphid then
- local pc = my_node_props(p).unicode or p.char or 0
- return is_cjk_char(pc)
- end
- end
- return is_cjk_char(c)
- end
-end
-
-local function is_noncjk (n, c) -- node, char
- if n and c then
- if is_unicode_var_sel(c) then
- local p = getprev(n)
- if p and p.id == glyphid then
- local pc = my_node_props(p).unicode or p.char or 0
- return is_noncjk_char(pc)
- end
- end
- return is_noncjk_char(c)
- end
-end
-
local function do_interhangul_option (head, curr, pc, c, fontid, par)
- local cc = (is_hangul(c) or is_chosong(c)) and 1 or 0
+ local cc = (is_hangul(c) or is_compat_jamo(c) or is_chosong(c)) and 1 or 0
if cc*pc == 1 and curr.lang ~= nohyphen then
local dim = get_font_opt_dimen(fontid, "interhangul")
@@ -757,17 +791,32 @@ local function process_interhangul (head, par)
local id = curr.id
if id == glyphid then
local c = my_node_props(curr).unicode or curr.char
- head, pc = do_interhangul_option(head, curr, pc, c, curr.font, par)
+ if c and not is_unicode_var_sel(c) then
+ head, pc = do_interhangul_option(head, curr, pc, c, curr.font, par)
- if is_chosong(c) then
- pc = 0
- elseif is_jungsong(c) or is_jongsong(c) or hangul_tonemark[c] then
- pc = 1
+ if is_chosong(c) then
+ pc = 0
+ elseif is_jungsong(c) or is_jongsong(c) or hangul_tonemark[c] then
+ pc = 1
+ end
end
- elseif id == hlistid and has_attribute(curr, rubyattr) then
- local c, fi = ruby_char_font(curr)
- head, pc = do_interhangul_option(head, curr, pc, c, fi, par)
+ elseif id == hlistid and curr.list then
+ if has_attribute(curr, rubyattr) then
+ local c, f = ruby_char_font(curr)
+ if c and f then
+ head, pc = do_interhangul_option(head, curr, pc, c, f, par)
+ else
+ pc = 0
+ end
+ else
+ local c, f = hbox_ini_char_font(curr)
+ if c and f then
+ head = do_interhangul_option(head, curr, pc, c, f, par)
+ end
+ c = hbox_fin_char_font(curr)
+ pc = c and is_hangul_jamo(c) and 1 or 0
+ end
elseif id == whatsitid and curr.mode == directmode then
local glyf, c = get_actualtext(curr)
@@ -787,21 +836,21 @@ local function process_interhangul (head, par)
end
local function do_interlatincjk_option (head, curr, pc, pf, pcl, c, cf, par)
- local cc = is_cjk(curr, c) and 1 or is_noncjk(curr, c) and 2 or 0
+ local cc = is_cjk_char(c) and 1 or is_noncjk_char(c) and 2 or 0
local old = has_attribute(curr, classicattr)
local ccl = get_char_class(c, old)
if cc*pc == 2 and curr.lang ~= nohyphen then
local brb = cc == 2 or breakable_before[c] -- numletter != br_before
if brb then
- local fid = cc == 1 and cf or pf
- local dim = get_font_opt_dimen(fid, "interlatincjk")
+ local f = cc == 1 and cf or pf
+ local dim = get_font_opt_dimen(f, "interlatincjk")
if dim then
local ict = old and intercharclass[pcl][ccl] -- under classic env. only
if ict then
- dim = get_font_opt_dimen(fid, "intercharacter") or 0
+ dim = get_font_opt_dimen(f, "intercharacter") or 0
end
- head = insert_glue_before(head, curr, par, true, brb, old, ict, dim, fid)
+ head = insert_glue_before(head, curr, par, true, brb, old, ict, dim, f)
end
end
end
@@ -815,12 +864,33 @@ local function process_interlatincjk (head, par)
local id = curr.id
if id == glyphid then
local c = my_node_props(curr).unicode or curr.char
- head, pc, pf, pcl = do_interlatincjk_option(head, curr, pc, pf, pcl, c, curr.font, par)
- pc = breakable_after[c] and pc or 0
+ if c and not is_unicode_var_sel(c) then
+ head, pc, pf, pcl = do_interlatincjk_option(head, curr, pc, pf, pcl, c, curr.font, par)
+ pc = breakable_after[c] and pc or 0
+ end
- elseif id == hlistid and has_attribute(curr, rubyattr) then
- local c, cf = ruby_char_font(curr)
- head, pc, pf, pcl = do_interlatincjk_option(head, curr, pc, pf, pcl, c, cf, par)
+ elseif id == hlistid and curr.list then
+ if has_attribute(curr, rubyattr) then
+ local c, f = ruby_char_font(curr)
+ if c and f then
+ head, pc, pf, pcl = do_interlatincjk_option(head, curr, pc, pf, pcl, c, f, par)
+ else
+ pc, pf, pcl = 0, 0, 0
+ end
+ else
+ local c, f = hbox_ini_char_font(curr)
+ if c and f then
+ head = do_interlatincjk_option(head, curr, pc, pf, pcl, c, f, par)
+ end
+ c, f = hbox_fin_char_font(curr)
+ if c and breakable_after[c] then
+ pc = is_cjk_char(c) and 1 or is_noncjk_char(c) and 2 or 0
+ else
+ pc = 0
+ end
+ pcl = c and get_char_class(c, has_attribute(curr, classicattr)) or 0
+ pf = f or 0
+ end
elseif id == whatsitid and curr.mode == directmode then
local glyf, c = get_actualtext(curr)
@@ -833,16 +903,17 @@ local function process_interlatincjk (head, par)
if pc == 1 then
head = do_interlatincjk_option(head, curr, pc, pf, pcl, 0x30, pf, par)
end
- pc, pcl, curr = 2, 0, end_of_math(curr)
+ pc, pf, pcl = 2, 0, 0
+ curr = end_of_math(curr)
elseif id == dirid then
if pc == 1 and curr.dir:sub(1,1) == "+" then
head = do_interlatincjk_option(head, curr, pc, pf, pcl, 0x30, pf, par)
- pc, pcl = 0, 0
+ pc, pf, pcl = 0, 0, 0
end
elseif is_blocking_node(curr) then
- pc, pcl = 0
+ pc, pf, pcl = 0, 0, 0
end
curr = getnext(curr)
end
@@ -861,18 +932,28 @@ local function process_remove_spaces (head)
for k, v in pairs{ p = getprev(curr), n = getnext(curr) } do
local ok
while v do
- local vid = v.id
- if vid ~= whatsitid -- skip whatsit or kern except userkern
- and ( vid ~= kernid or v.subtype == userkern ) then
+ local id = v.id
+ if id ~= whatsitid -- skip whatsit or kern except userkern
+ and ( id ~= kernid or v.subtype == userkern ) then
local vchar, vfont
- if vid == glyphid and v.lang ~= nohyphen then
- vchar, vfont = v.char, v.font
- elseif vid == hlistid and has_attribute(v, rubyattr) then
- vchar, vfont = ruby_char_font(v)
+ if id == glyphid and v.lang ~= nohyphen then
+ local c = my_node_props(v).unicode or v.char or 0
+ if is_unicode_var_sel(c) then
+ v = getprev(v) or v
+ end
+ vchar, vfont = my_node_props(v).unicode or v.char, v.font
+ elseif id == hlistid and v.list then
+ if has_attribute(v, rubyattr) then
+ vchar, vfont = ruby_char_font(v)
+ elseif k == "p" then
+ vchar, vfont = hbox_fin_char_font(v)
+ else
+ vchar, vfont = hbox_ini_char_font(v)
+ end
end
if vchar and vfont and option_in_font(vfont, opt_name) then
- ok = is_cjk(v, vchar)
+ ok = is_cjk_char(vchar)
end
break
@@ -1037,7 +1118,11 @@ local function process_dotemph (head, tofree)
local dotattr = has_attribute(curr, dotemphattr)
if dotattr then
local c = my_node_props(curr).unicode or curr.char
- if is_hangul(c) or is_hanja(c) or is_chosong(c) or is_kana(c) then
+ if is_hangul(c) or
+ is_compat_jamo(c) or
+ is_chosong(c) or
+ is_hanja(c) or
+ is_kana(c) then
local currwd = curr.width
if currwd >= get_en_size(curr.font) then
local box = nodecopy(dotemphbox[dotattr])
@@ -1178,7 +1263,7 @@ local function getrubystretchfactor (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))
+ set_macro("luatexkostretchfactor", stringformat("%.4f", str/em/2))
end
end
luatexko.getrubystretchfactor = getrubystretchfactor
@@ -1517,10 +1602,12 @@ local function process_vertical_font (fontdata)
local scale = parameters.factor or 655.36
local quad = parameters.quad or 655360
local ascender = parameters.ascender or quad*0.8
- local goffset = fontdata_opt_dim(fontdata, "charraise")
- if not goffset then
- goffset = (parameters.x_height or quad/2) / 2
- end
+
+ local goffset = fontdata_opt_dim(fontdata, "charraise") or
+ (parameters.x_height or quad/2)/2
+ -- declare shift amount of horizontal box inside vertical env.
+ fontdata.horizboxmoveleftamount = quad/2-goffset
+
for i,v in pairs(fontdata.characters) do
local voff = goffset - (v.width or 0)/2
local bbox = descriptions[i] and descriptions[i].boundingbox or {0,0,0,0}
@@ -1585,6 +1672,22 @@ local function process_vertical_font (fontdata)
end
end
+local function get_horizbox_moveleft ()
+ for _, v in ipairs{ fontcurrent(),
+ texattribute.luatexkohangulfontattr,
+ texattribute.luatexkohanjafontattr,
+ texattribute.luatexkofallbackfontattr } do
+ if v and v > 0 then
+ local amount = get_font_data(v).horizboxmoveleftamount
+ if amount then
+ set_macro("luatexkohorizboxmoveleft", texsp(amount).."sp")
+ break
+ end
+ end
+ end
+end
+luatexko.gethorizboxmoveleft = get_horizbox_moveleft
+
-- charraise
local function process_charriase_font (fontdata)
@@ -1807,11 +1910,17 @@ function(head)
local curr = head
while curr do
local id = curr.id
- if id == glyphid then
- if curr.subtype == 1 and
- curr.lang ~= nohyphen and
- is_cjk(curr, curr.char) then
- curr.lang = langkor
+ if id == glyphid and curr.subtype == 1 and curr.lang ~= nohyphen then
+ local c = curr.char
+ if c then
+ if is_unicode_var_sel(c) then
+ local p = getprev(curr)
+ if p.id == glyphid then
+ curr.lang = p.lang
+ end
+ elseif is_cjk_char(c) then
+ curr.lang = langkor
+ end
end
elseif id == mathid then
curr = end_of_math(curr)
@@ -1858,25 +1967,3 @@ local function current_has_hangul_chars (cnt)
end
luatexko.currenthashangulchars = current_has_hangul_chars
-local function get_gid_of_charslot (fd, slot)
- if type(fd) == "number" then
- fd = get_font_data(fd)
- end
- local character = fd.characters[slot]
- return character and character.index
-end
-luatexko.get_gid_of_charslot = get_gid_of_charslot
-
-local function get_charslots_of_gid (fd, gid)
- if type(fd) == "number" then
- fd = get_font_data(fd)
- end
- local t = {}
- for i, v in pairs(fd.characters) do
- if v.index == gid then
- t[#t + 1] = i
- end
- end
- return t
-end
-luatexko.get_charslots_of_gid = get_charslots_of_gid
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index dbe1be8411a..7599a0977b7 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/06/21 v2.3 typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko}[2019/08/01 v2.4 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}
\else
@@ -257,7 +257,9 @@
\pdfliteral{q 0 -1 1 0 0 0 cm}\box#1\pdfliteral{Q}%
\vfil }}}
% horizontal box inside vertical writing
+\def\luatexkohorizboxmoveleft{0.5ex}
\protected\def\horizontal#1{%
+ \directlua{ luatexko.gethorizboxmoveleft() }%
\leavevmode
\setbox\z@\vbox\bgroup
\hsize#1\relax
@@ -265,7 +267,7 @@
\protected\def\endhorizontal{%
\egroup
\luatexkounrotatebox\z@
- \box\z@ }
+ \lower\luatexkohorizboxmoveleft\box\z@ }
\protected\def\luatexkounrotatebox#1{%
\setbox#1\hbox to\dimexpr\ht#1+\dp#1{%
\vbox to\wd#1{%