summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-03-03 03:01:26 +0000
committerNorbert Preining <norbert@preining.info>2021-03-03 03:01:26 +0000
commit6a1383661dd7817761345a9d4ddfd9db6ba2dd1e (patch)
treedec33644ee8df10255c235853ff6ef809b223a90 /macros/luatex
parent4763ec8ceefaf2b038d591b8c15d88d081aec6c9 (diff)
CTAN sync 202103030301
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/generic/luatexko/ChangeLog14
-rw-r--r--macros/luatex/generic/luatexko/README2
-rw-r--r--macros/luatex/generic/luatexko/luatexko-doc.pdfbin325482 -> 328095 bytes
-rw-r--r--macros/luatex/generic/luatexko/luatexko-doc.tex61
-rw-r--r--macros/luatex/generic/luatexko/luatexko-normalize.lua6
-rw-r--r--macros/luatex/generic/luatexko/luatexko-uhc2utf8.lua6
-rw-r--r--macros/luatex/generic/luatexko/luatexko.lua390
-rw-r--r--macros/luatex/generic/luatexko/luatexko.sty147
-rw-r--r--macros/luatex/generic/luavlna/README.md2
-rw-r--r--macros/luatex/generic/luavlna/luavlna-doc.pdfbin91253 -> 92289 bytes
-rw-r--r--macros/luatex/generic/luavlna/luavlna-doc.tex19
-rw-r--r--macros/luatex/generic/luavlna/luavlna.sty4
-rw-r--r--macros/luatex/generic/luavlna/luavlna.tex29
13 files changed, 390 insertions, 290 deletions
diff --git a/macros/luatex/generic/luatexko/ChangeLog b/macros/luatex/generic/luatexko/ChangeLog
index 993b9d0d01..e0dc310e65 100644
--- a/macros/luatex/generic/luatexko/ChangeLog
+++ b/macros/luatex/generic/luatexko/ChangeLog
@@ -1,3 +1,17 @@
+2021-03-01 Dohyun Kim <nomos at ktug org>
+
+ Version 3.0
+
+ * luatexko.lua:
+ do not adjust interword glue after CJK characters
+ when current font is a monospaced font;
+ fix a bug wrt dotemph/ruby/sout position in vertical writing.
+
+ * luatexko.sty:
+ horizontal metrics of default Hangul monospaced font are
+ matched with those of Latin Modern Mono;
+ deprecated command \actualtext is now removed.
+
2020-07-27 Dohyun Kim <nomos at ktug org>
Version 2.9
diff --git a/macros/luatex/generic/luatexko/README b/macros/luatex/generic/luatexko/README
index 5721c1047a..204f8183bb 100644
--- a/macros/luatex/generic/luatexko/README
+++ b/macros/luatex/generic/luatexko/README
@@ -1,4 +1,4 @@
-LuaTeX-ko Package version 2.9 (2020/07/27)
+LuaTeX-ko Package version 3.0 (2021/03/01)
===========================================
This is a Lua(La)TeX macro package that supports typesetting Korean
diff --git a/macros/luatex/generic/luatexko/luatexko-doc.pdf b/macros/luatex/generic/luatexko/luatexko-doc.pdf
index 10bc1d0a27..a8b7ae9d40 100644
--- a/macros/luatex/generic/luatexko/luatexko-doc.pdf
+++ b/macros/luatex/generic/luatexko/luatexko-doc.pdf
Binary files differ
diff --git a/macros/luatex/generic/luatexko/luatexko-doc.tex b/macros/luatex/generic/luatexko/luatexko-doc.tex
index 0a5691b9ca..ea7d4fc938 100644
--- a/macros/luatex/generic/luatexko/luatexko-doc.tex
+++ b/macros/luatex/generic/luatexko/luatexko-doc.tex
@@ -31,7 +31,7 @@
}
fonts.protrusions.setups.notoserifcjk = notoserifcjkkr_hb
}
-\defaultfontfeatures+{Renderer=OpenType}
+\defaultfontfeatures+{Renderer=HarfBuzz}
\setmainfont{Latin Modern Roman}[Expansion] % for hb tlig
\setmainhangulfont{Noto Serif CJK KR}[
Scale=0.98,
@@ -85,7 +85,7 @@
RawFeature=vertical,
CompressPunctuations,
InterCharStretch=1pt,
- CharRaise=3.6pt,
+ CharRaise=1pt,
CharacterWidth=Full,
]
\newhangulfontface\rubyfont{Noto Serif CJK KR Medium}[
@@ -97,8 +97,9 @@
\def\XeTeX{\hologo{XeTeX}}
\usepackage[hidelinks]{hyperref}
-\edef\verbatim{\unexpanded\expandafter{\verbatim\linespread{1.1}\selectfont}}
-\edef\itemize{\unexpanded\expandafter{\itemize\small}}
+\AddToHook{env/itemize/begin}{\small}
+\AddToHook{env/verbatim/begin}{\linespread{1.1}}
+
\catcode`|=13 \protected\def|{\verb|\let\\=\textbackslash}
\def\nohyphen{\language\csname l@nohyphenation\endcsname}
\protected\def\cs#1{\texttt{\nohyphen \textbackslash\detokenize{#1}}}
@@ -123,7 +124,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.9\quad 2020/07/27}
+\date{Version 3.0\quad 2021/03/01}
\maketitle
\begin{quote}
@@ -134,7 +135,7 @@
\section{부르기}\label{sec:loading}
-\hemph{\texlive\ 2020 이상}{ \small (\luatex\ v1.12 이상)}을 사용해야 한다.
+\hemph{\texlive\ 2021 이상}{ \small (\luatex\ v1.12 이상)}을 사용해야 한다.
\luatexko\ 부르기: \cs{usepackage{luatexko}} 혹은 \cs{usepackage{kotex}}.%
\footnote{%
@@ -213,10 +214,10 @@ verbatim 코드를 식자할 때는 이 기능이 작동하지 않으며,%
부연하건대, |\\language=\\l@nohyphenation| 상황에서 작동하지 않는
그밖의 기능은 다음과 같다: 줄바꿈 허용, InterCharacter, InterHangul,
InterLatinCJK, CompressPunctuations, RemoveClassicSpaces,
- 한글^^b7한자 폰트 문자 다음의 공백 크기 조정 등. }
-문장부호가 고정폭 글꼴일 때에도 작동하지 않는다.%
-\footnote{%
- 또한 플레인텍에서는 영문글꼴을 트루타입/오픈타입으로 지정해야만 작동한다. }
+ 한글^^b7한자 폰트 문자 다음의 공백 크기 조정 등. 마지막의
+ 한글^^b7한자 다음의 공백 크기 조정은 영문자가 고정폭 글꼴일 때에도
+ 작동하지 않는다. }
+문장부호가 고정폭 글꼴일 때에도 작동하지 않는다.
영향 받는 문장부호들의 기본값은 다음과 같다:
\begin{verbatim}
[0x21] ! [0x27] ' [0x28] ( [0x29] )
@@ -341,10 +342,10 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 있
\begin{verbatim}
[CharRaise=2pt]
\end{verbatim}
- 세로쓰기에서는 모든 글자들을 지정한 값만큼 오른쪽으로 이동시킨다.
- 세로쓰기에서 이 옵션 값을 고정길이{\small(가령 |pt| 단위)}로 주면
- 크기가 다른 폰트들간에 중앙정렬이 이루어진다.
- 세로쓰기에서 이 옵션을 주지 않으면 |0.5ex|가 기본값으로 동작한다.
+ 세로쓰기에서는 모든 글자들을 지정한 값만큼 오른쪽으로 이동시킨다.%
+ \footnote{%
+ 세로쓰기에서는 이 옵션 값을 고정길이(가령 |pt| 단위)로 주어야
+ 크기가 다른 폰트들간에 중앙정렬이 유지된다. }
\item[RemoveClassicSpaces] \pkgkwd*{RemoveClassicSpaces}%
고문헌 조판시에 CJK 글자들 사이의 공백을 없애준다.%
@@ -353,10 +354,12 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 있
\item[CompressPunctuations] \pkgkwd*{CompressPunctuations}%
CJK 구두점 {\small (낫표 따위)}의 글자폭을
- 반각으로 만든다. v2.0부터는 사용자가 지시하지 않는 한 자동으로 글자폭을
- 줄여주지 않는다.%
+ 반각으로 만든다.%
\footnote{%
- 플레인텍에서는 |+compresspunctuations|. }
+ 플레인텍에서는 |+compresspunctuations|.
+ }\,\footnote{%
+ v2.0부터는 사용자가 지시하지 않는 한 자동으로 글자폭을 줄여주지 않는다.
+ }
이 옵션은 |CharacterWidth=AlternateHalf| 내지 {\small (세로쓰기의 경우)}
|Vertical=HalfMetrics|와 거의 같은 기능을 한다.%
\footnote{%
@@ -439,16 +442,17 @@ v2.0부터는 고문헌 조판에서 한글^^b7한자와 영문자가 붙어 나
|vmtx| 정보를 가지고 있지 않은 글꼴은 세로쓰기에 적합치 않은 글꼴이다.
|otfinfo -t <파일>| 명령으로 글꼴에 들어있는 테이블 정보를 알 수 있다. }\,%
\footnote{%
- 폰트 옵션 |Renderer=OpenType| 또는 |Renderer=HarfBuzz| 등
+ 폰트 옵션 |Renderer=HarfBuzz| 또는 |Renderer=OpenType| 등
(플레인텍에서는 |mode=harf| 옵션)을 주고
컴파일하여 HarfBuzz 모듈을 이용하려는 경우 세로쓰기가
현재로서는 지원되지 않는다. 세로쓰기를 하려면 이 옵션을 빼고 디폴트 값인
- |Renderer=Node| (플레인텍에서는 |mode=node|)를 사용하라.}
+ |Renderer=Node| (플레인텍에서는 |mode=node|)를 사용하라.}\,%
+\footnote{%
+ 세로쓰기에서는 \cs{typesetclassic}의 아종인 \cs{typesetvertical}이
+ 기본으로 셋팅되어 있다. 일종의 고문헌 조판으로 보는 것이다.
+}
세로쓰기에서 |CharRaise| 옵션의 효과에 대해서는 제\ref{sec:fontoption}절을
-참조할 것.
-
-세로쓰기에서는 \cs{typesetclassic}의 아종인 \cs{typesetvertical}이
-기본으로 셋팅되어 있다. 일종의 고문헌 조판으로 보는 것이다.
+참조.
\begin{figure}
\framebox[\linewidth]{
@@ -491,8 +495,7 @@ v2.0부터는 고문헌 조판에서 한글^^b7한자와 영문자가 붙어 나
환경을 이용한다. |<dimen>|은 가로쓰기 박스의 너비를 지시한다.%
\footnote{%
플레인텍에서는 \cs{horizontal{<dimen>}} \ldots\ \cs{endhorizontal}. }
-가로쓰기 영역의 폰트 설정은 사용자의 몫이다.%
-\footnote{폰트 지시는 |horizontal| 환경 안에서 행하는 것을 권장한다.}
+가로쓰기 영역의 폰트 설정은 사용자의 몫이다.
\begin{figure}
\framebox[\linewidth]{
@@ -724,6 +727,14 @@ v2.0부터는 자동으로 수식 한글을 잡아주지 않는다.%
\section*{주요 변경 이력}
\begin{itemize}\linespread{1.1}\selectfont
+ \item[v3.0] ------
+ \item \hyperref[sec:fontoption]{세로쓰기에서 |CharRaise| 옵션은
+ 이제 글자들의 \dotemph{추가적인} 이동 길이를 나타낸다.}
+ \item 기본 로드되는 고정폭 한글 폰트(UnDotum)의 폭을
+ Latin Modern Mono 폰트에 맞추어 조정
+ \item \hyperref[sec:fontswitch]{영문자가 고정폭 글꼴일 때
+ 한글^^b7한자 다음에 공백 크기 조정을 하지 않음}
+ \item \cs{actualtext} 명령 제거
\item[v2.6] ------
\item \hyperref[sec:fontswitch]{\cs{hangulbyhangulfont} 및
\cs{hanjabyhanjafont}가 지역적 효력만 가짐}
diff --git a/macros/luatex/generic/luatexko/luatexko-normalize.lua b/macros/luatex/generic/luatexko/luatexko-normalize.lua
index ef8edbd587..2dec726fb6 100644
--- a/macros/luatex/generic/luatexko/luatexko-normalize.lua
+++ b/macros/luatex/generic/luatexko/luatexko-normalize.lua
@@ -1,6 +1,6 @@
-- luatexko-normalize.lua
--
--- Copyright (c) 2013-2020 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2021 Dohyun Kim <nomos at ktug org>
-- Soojin Nam <jsunam at gmail com>
--
-- This work may be distributed and/or modified under the
@@ -13,8 +13,8 @@
luatexbase.provides_module({
name = "luatexko-normalize",
- version = "2.9",
- date = "2020/07/27",
+ version = "3.0",
+ date = "2021/03/01",
author = "Dohyun Kim, Soojin Nam",
description = "Hangul normalization",
license = "LPPL v1.3+",
diff --git a/macros/luatex/generic/luatexko/luatexko-uhc2utf8.lua b/macros/luatex/generic/luatexko/luatexko-uhc2utf8.lua
index 40c5748b6f..e82bf2cdfe 100644
--- a/macros/luatex/generic/luatexko/luatexko-uhc2utf8.lua
+++ b/macros/luatex/generic/luatexko/luatexko-uhc2utf8.lua
@@ -1,6 +1,6 @@
-- luatexko-uhc2utf8.lua
--
--- Copyright (c) 2013-2020 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2021 Dohyun Kim <nomos at ktug org>
-- Soojin Nam <jsunam at gmail com>
--
-- This work may be distributed and/or modified under the
@@ -13,8 +13,8 @@
luatexbase.provides_module({
name = "luatexko-uhc2utf8",
- version = "2.9",
- date = "2020/07/27",
+ version = "3.0",
+ date = "2021/03/01",
author = "Dohyun Kim, Soojin Nam",
description = "UHC (CP949) input encoding",
license = "LPPL v1.3+",
diff --git a/macros/luatex/generic/luatexko/luatexko.lua b/macros/luatex/generic/luatexko/luatexko.lua
index 8b7f15b966..22fcaf54cf 100644
--- a/macros/luatex/generic/luatexko/luatexko.lua
+++ b/macros/luatex/generic/luatexko/luatexko.lua
@@ -1,6 +1,6 @@
-- luatexko.lua
--
--- Copyright (c) 2013-2020 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2021 Dohyun Kim <nomos at ktug org>
-- Soojin Nam <jsunam at gmail com>
--
-- This work may be distributed and/or modified under the
@@ -13,8 +13,8 @@
luatexbase.provides_module {
name = 'luatexko',
- date = '2020/07/27',
- version = '2.9',
+ date = '2021/03/01',
+ version = '3.0',
description = 'typesetting Korean with LuaTeX',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -41,6 +41,7 @@ local noderemove = node.remove
local nodeslide = node.slide
local nodewrite = node.write
local rangedimensions = node.rangedimensions
+local set_attribute = node.set_attribute
local setglue = node.setglue
local setproperty = node.setproperty
local unset_attribute = node.unset_attribute
@@ -69,12 +70,10 @@ local tableunpack = table.unpack
local add_to_callback = luatexbase.add_to_callback
local attributes = luatexbase.attributes
local call_callback = luatexbase.call_callback
-local callback_descriptions = luatexbase.callback_descriptions
local create_callback = luatexbase.create_callback
local module_warning = luatexbase.module_warning
local new_user_whatsit = luatexbase.new_user_whatsit
local registernumber = luatexbase.registernumber
-local remove_from_callback = luatexbase.remove_from_callback
local function warning (...)
return module_warning("luatexko", stringformat(...))
@@ -141,21 +140,23 @@ local function option_in_font (fontdata, optionname)
if type(fontdata) == "number" then
fontdata = get_font_data(fontdata)
end
- if fontdata.specification then
- return fontdata.specification.features.normal[optionname]
+ if fontdata.shared then
+ return fontdata.shared.features[optionname]
end
end
local function font_opt_dim (fd, optname)
local dim = option_in_font(fd, optname)
if dim then
- local params
+ local params, m, u
if type(fd) == "number" then
params = getparameters(fd)
else
params = fd.parameters
end
- local m, u = dim:match"^(.+)(e[mx])%s*$"
+ if type(dim) == "string" then
+ m, u = dim:match"^(.+)(e[mx])%s*$"
+ end
if m and u and params then
if u == "em" then
dim = m * params.quad
@@ -473,20 +474,27 @@ end
local function hangul_space_skip (curr, newfont)
if curr.lang ~= nohyphen and curr.font ~= newfont then
- local n = getnext(curr)
- if n and n.id == glueid and n.subtype == spaceskip then
- local params = getparameters(curr.font)
- local oldwd, oldst, oldsh, oldsto, oldsho = getglue(n)
- if params
- and oldwd == params.space
- and oldst == params.space_stretch
- and oldsh == params.space_shrink
- and oldsto == 0
- and oldsho == 0 then -- not user's spaceskip
-
- local newwd = font_options.hangulspaceskip[newfont]
- if newwd then
- setglue(n, newwd[1], newwd[2], newwd[3])
+ -- fontloader's "node" mode sets space_stretch to zero
+ -- when the font is a monospaced font (fontspec's \setmonofont
+ -- command does the same thing), which we will bypass here
+ -- for alignment of CJK and Latin glyphs in verbatim environment.
+ -- See http://www.ktug.org/xe/index.php?document_srl=249772
+ if not font_options.monospaced[curr.font] then
+ local n = getnext(curr)
+ if n and n.id == glueid and n.subtype == spaceskip then
+ local params = getparameters(curr.font)
+ local oldwd, oldst, oldsh, oldsto, oldsho = getglue(n)
+ if params
+ and oldwd == params.space
+ and oldst == params.space_stretch
+ and oldsh == params.space_shrink
+ and oldsto == 0
+ and oldsho == 0 then -- not user's spaceskip
+
+ local newwd = font_options.hangulspaceskip[newfont]
+ if newwd then
+ setglue(n, newwd[1], newwd[2], newwd[3])
+ end
end
end
end
@@ -1290,6 +1298,7 @@ function luatexko.get_strike_out_down (box)
else
down = -0.5*ex
end
+
local raise = font_options.charraise[f] or 0
return down - raise
end
@@ -1729,12 +1738,21 @@ local function fontdata_warning(activename, ...)
end
end
+local dfltfntsize = get_font_param(fontcurrent(), "quad") or 655360
+
local function process_vertical_font (fontdata)
+ local fullname = fontdata.fullname
+
+ if fontdata.type == "virtual" then
+ fontdata_warning("vitrual."..fullname,
+ "Virtual font `%s' cannot be\nused for vertical writing.", fullname)
+ return
+ end
+
local subfont = fontdata.specification and fontdata.specification.sub
local tsb_tab = get_tsb_table(fontdata.filename, subfont)
if not tsb_tab then
- local fullname = fontdata.fullname
fontdata_warning("vertical."..fullname,
"Vertical metrics table (vmtx) not found in the font\n`%s'", fullname)
return
@@ -1745,12 +1763,13 @@ local function process_vertical_font (fontdata)
local parameters = fontdata.parameters or {}
local scale = parameters.factor or 655.36
local quad = parameters.quad or 655360
+ local xheight = parameters.x_height or quad/2
local ascender = parameters.ascender or quad*0.8
- local goffset = font_opt_dim(fontdata, "charraise") or
- (parameters.x_height or quad/2)/2
+ local goffset = xheight/2 * (dfltfntsize / quad) -- TODO?
+
-- declare shift amount of horizontal box inside vertical env.
- fontdata.horizboxmoverightamount = goffset
+ fontdata.vertcharraise = goffset
for i,v in pairs(fontdata.characters) do
local voff = goffset - (v.width or 0)/2
@@ -1780,6 +1799,8 @@ local function process_vertical_font (fontdata)
parameters.space_stretch = spacechar.width/2
parameters.space_shrink = spacechar.width/2
end
+ parameters.ascender = quad/2 + goffset
+ parameters.descender = quad/2 - goffset
local res = fontdata.resources or {}
local fea = shared.features or {}
@@ -1822,8 +1843,9 @@ function luatexko.gethorizboxmoveright ()
texattribute.luatexkohanjafontattr,
texattribute.luatexkofallbackfontattr } do
if v and v > 0 then
- local amount = get_font_data(v).horizboxmoverightamount
+ local amount = get_font_data(v).vertcharraise
if amount then
+ amount = amount + (font_options.charraise[v] or 0)
set_macro("luatexkohorizboxmoveright", texsp(amount).."sp")
break
end
@@ -1833,19 +1855,25 @@ end
-- charraise
+local raiseattr = luatexbase.new_attribute"luatexkoraiseattr"
+
local function process_charraise (head)
local curr = head
while curr do
- if curr.id == glyphid then
- local f = curr.font
- local raise = font_options.charraise[f]
- if raise and not option_in_font(f, "vertical") then
- local props = my_node_props(curr)
- if not props.charraised then
+ local id = curr.id
+ if id == glyphid then
+ if not has_attribute(curr,raiseattr) then
+ local f = curr.font
+ local raise = font_options.charraise[f]
+ if raise then
curr.yoffset = (curr.yoffset or 0) + raise
- props.charraised = true
end
+ set_attribute(curr, raiseattr, 1)
end
+ elseif id == discid then
+ process_charraise(curr.pre)
+ process_charraise(curr.post)
+ process_charraise(curr.replace)
end
curr = getnext(curr)
end
@@ -1899,19 +1927,15 @@ local function process_fake_slant_corr (head) -- for font fallback
return head
end
-local function process_fake_slant_font (fontdata)
- local fsl = fontdata.slant
+local function process_fake_slant_font (fontdata, fsl)
if fsl and fsl > 0 then
- fsl = fsl/1000
- local hb = is_harf(fontdata)
+ fontdata.slant = fsl*1000
local params = fontdata.parameters or {}
- if not hb then -- hb done by luaotfload
- params.slant = (params.slant or 0) + fsl*65536 -- slant per point
- end
+ params.slant = (params.slant or 0) + fsl*65536 -- slant per point
+ local hb = is_harf(fontdata)
local scale = hb and hb.scale or params.factor or 655.36
-
local shared = fontdata.shared or {}
local descrs = shared.rawdata and shared.rawdata.descriptions or {}
@@ -1945,9 +1969,7 @@ end
-- wrap up
local pass_fun = function(...) return ... end
-create_callback("luatexko_hpack_first", "data", pass_fun)
create_callback("luatexko_prelinebreak_first", "data", pass_fun)
-create_callback("luatexko_hpack_second", "data", pass_fun)
create_callback("luatexko_prelinebreak_second", "data", pass_fun)
create_callback("luatexko_do_atbegshi", "data", pass_fun)
@@ -1957,141 +1979,181 @@ function luatexko.process_atbegshi (box)
end
end
-add_to_callback("hpack_filter", function(h)
+add_to_callback("pre_shaping_filter", function(h, gc)
+ local par = gc == ""
+ or gc == "vbox"
+ or gc == "vtop"
+ or gc == "insert"
+ or gc == "vcenter"
h = process_fonts(h)
- h = call_callback("luatexko_hpack_first", h)
- h = call_callback("luatexko_hpack_second", h)
- return process_linebreak(h)
-end, "luatexko.hpack_filter.pre_rendering", 1)
+ h = call_callback("luatexko_prelinebreak_first", h, par)
+ h = call_callback("luatexko_prelinebreak_second", h, par)
+ return process_linebreak(h, par)
+end, "luatexko.pre_shaping_filter")
-add_to_callback("pre_linebreak_filter", function(h)
- h = process_fonts(h)
- h = call_callback("luatexko_prelinebreak_first", h, true)
- h = call_callback("luatexko_prelinebreak_second", h, true)
- return process_linebreak(h, true)
-end, "luatexko.pre_linebreak_filter.pre_rendering", 1)
-
-local font_opt_procs = {
- removeclassicspaces = {
- luatexko_hpack_first = process_remove_spaces,
- luatexko_prelinebreak_first = process_remove_spaces,
- },
- interhangul = {
- luatexko_hpack_second = process_interhangul,
- luatexko_prelinebreak_second = process_interhangul,
+local otfregister = fonts.constructors.features.otf.register
+
+local function activate_process (cbnam, cbfun, name)
+ if not active_processes[name] then
+ add_to_callback(cbnam, cbfun, "luatexko."..cbnam.."."..name)
+ active_processes[name] = true
+ end
+end
+
+otfregister {
+ name = "removeclassicspaces",
+ description = "remove spaces in classic typesetting",
+ default = false,
+ manipulators = {
+ node = function()
+ activate_process("luatexko_prelinebreak_first", process_remove_spaces, "removeclassicspaces")
+ end,
+ plug = function()
+ activate_process("luatexko_prelinebreak_first", process_remove_spaces, "removeclassicspaces")
+ end,
},
- interlatincjk = {
- luatexko_hpack_second = process_interlatincjk,
- luatexko_prelinebreak_second = process_interlatincjk,
+}
+
+otfregister {
+ name = "interhangul",
+ description = "insert more glue between Hangul chars",
+ default = false,
+ manipulators = {
+ node = function()
+ activate_process("luatexko_prelinebreak_second", process_interhangul, "interhangul")
+ end,
+ plug = function()
+ activate_process("luatexko_prelinebreak_second", process_interhangul, "interhangul")
+ end,
},
- charraise = {
- hpack_filter = process_charraise,
- pre_linebreak_filter = process_charraise,
+}
+
+otfregister {
+ name = "interlatincjk",
+ description = "insert glue between CJK and Latin",
+ default = false,
+ manipulators = {
+ node = function()
+ activate_process("luatexko_prelinebreak_second", process_interlatincjk, "interlatincjk")
+ end,
+ plug = function()
+ activate_process("luatexko_prelinebreak_second", process_interlatincjk, "interlatincjk")
+ end,
},
- compresspunctuations = {
- hpack_filter = process_glyph_width,
- pre_linebreak_filter = process_glyph_width,
+}
+
+otfregister {
+ name = "charraise",
+ description = "raise chars",
+ default = false,
+ manipulators = {
+ node = function(fontdata)
+ activate_process("post_shaping_filter", process_charraise, "charraise")
+ end,
+ plug = function(fontdata)
+ activate_process("post_shaping_filter", process_charraise, "charraise")
+ end,
},
- slant = {
- hpack_filter = process_fake_slant_corr,
- pre_linebreak_filter = process_fake_slant_corr,
+}
+
+otfregister {
+ name = "compresspunctuations",
+ description = "compress width of CJK punctuations",
+ default = false,
+ manipulators = {
+ node = function()
+ activate_process("post_shaping_filter", process_glyph_width, "compresspunctuations")
+ end,
+ plug = function()
+ activate_process("post_shaping_filter", process_glyph_width, "compresspunctuations")
+ end,
},
}
--- luaotfload expansion feature, committed at 2020.06.08
-luatexko.plug_expansion_loaded = false
-for _,v in next, fonts.handlers.otf.features.manipulators.plug do
- if v.name == "expansion" then
- luatexko.plug_expansion_loaded = true
- break
- end
-end
+otfregister {
+ name = "slant",
+ description = "fake slant fallback fonts",
+ default = false,
+ manipulators = {
+ node = function(fontdata, _, value)
+ process_fake_slant_font(fontdata, value)
+ activate_process("post_shaping_filter", process_fake_slant_corr, "slant")
+ end,
+ plug = function(fontdata, _, value)
+ process_fake_slant_font(fontdata, value)
+ activate_process("post_shaping_filter", process_fake_slant_corr, "slant")
+ end,
+ },
+}
-local font_opt_procs_single = {
- expansion = function(fontdata)
- if not luatexko.plug_expansion_loaded and is_harf(fontdata) then
- local val = option_in_font(fontdata, "expansion")
- local setup = fonts.expansions.setups[val] or {}
- fontdata.stretch = fontdata.stretch or (setup.stretch or 2)*10
- fontdata.shrink = fontdata.shrink or (setup.shrink or 2)*10
- fontdata.step = fontdata.step or (setup.step or .5)*10
- end
- if tex.adjustspacing == 0 then
- texset("global", "adjustspacing", 2)
- end
- end,
-
- protrusion = function(fontdata)
- if is_harf(fontdata) then -- for now, no support in harf mode
- local val = option_in_font(fontdata, "protrusion")
- local setup = fonts.protrusions.setups[val] or {}
- local quad = fontdata.parameters.quad
- for i, v in pairs(setup) do
- local chr = fontdata.characters[i]
- if chr then
- local wdq = chr.width/quad
- chr.left_protruding = chr.left_protruding or wdq*v[1]*1000
- chr.right_protruding = chr.right_protruding or wdq*v[2]*1000
- end
- end
- end
- if tex.protrudechars == 0 then
- texset("global", "protrudechars", 2)
- end
- if option_in_font(fontdata, "compresspunctuations") then
+otfregister {
+ name = "vertical",
+ description = "vertical typesetting",
+ default = false,
+ manipulators = {
+ node = process_vertical_font,
+ plug = function(fontdata)
local fullname = fontdata.fullname
- fontdata_warning("protrude."..fullname,
- "Both `compresspunctuations' and `protrusion' are\nenabled for `%s'.\n"..
- "Beware bad justifications.", fullname)
- end
- end,
-
- slant = process_fake_slant_font,
-
- vertical = function(fontdata)
- local fullname = fontdata.fullname
- if is_harf(fontdata) then
fontdata_warning("vertical."..fullname,
"Currently, vertical writing is not supported\nby harf mode."..
"`Renderer=Node' option is needed for\n`%s'", fullname)
- elseif fontdata.type == "virtual" then
- fontdata_warning("vitrual."..fullname,
- "Virtual font `%s' cannot be\nused for vertical writing.", fullname)
- else
- process_vertical_font(fontdata)
- end
- end,
+ end,
+ },
}
-local function process_patch_font (fontdata)
- if type(fontdata) ~= "table" or
- fontdata.format ~= "opentype" and fontdata.format ~= "truetype" then
- return
- end -- as we have called patch_font_unsafe for hb fonts
-
- for name, procs in pairs( font_opt_procs ) do
- if not active_processes[name] and option_in_font(fontdata, name) then
- if name == "charraise" and option_in_font(fontdata, "vertical") then
- else
- for cbnam, cbfun in pairs( procs ) do
- add_to_callback(cbnam, cbfun, "luatexko."..cbnam.."."..name)
- end
- active_processes[name] = true
+otfregister {
+ name = "expansion",
+ description = "glyph expansion",
+ default = false,
+ manipulators = {
+ node = function()
+ if tex.adjustspacing == 0 then
+ texset("global", "adjustspacing", 2)
end
- end
- end
+ end,
+ plug = function(fontdata, _, value)
+ local setup = fonts.expansions.setups[value] or {}
+ fontdata.stretch = fontdata.stretch or (setup.stretch or 2)*10
+ fontdata.shrink = fontdata.shrink or (setup.shrink or 2)*10
+ fontdata.step = fontdata.step or (setup.step or .5)*10
+ if tex.adjustspacing == 0 then
+ texset("global", "adjustspacing", 2)
+ end
+ end,
+ },
+}
- for name, func in pairs( font_opt_procs_single ) do
- if option_in_font(fontdata, name) then
- func(fontdata)
+local function process_protrusion (fontdata, _, value)
+ local setup = fonts.protrusions.setups[value] or {}
+ local quad = fontdata.parameters.quad
+ for i, v in pairs(setup) do
+ local chr = fontdata.characters[i]
+ if chr then
+ local wdq = chr.width/quad
+ chr.left_protruding = chr.left_protruding or wdq*v[1]*1000
+ chr.right_protruding = chr.right_protruding or wdq*v[2]*1000
end
end
+ if tex.protrudechars == 0 then
+ texset("global", "protrudechars", 2)
+ end
+ if option_in_font(fontdata, "compresspunctuations") then
+ local fullname = fontdata.fullname
+ fontdata_warning("protrude."..fullname,
+ "Both `compresspunctuations' and `protrusion' are\nenabled for `%s'.\n"..
+ "Beware bad justifications.", fullname)
+ end
end
-add_to_callback("luaotfload.patch_font", process_patch_font,
-"luatexko.patch_font")
-add_to_callback("luaotfload.patch_font_unsafe", process_patch_font,
-"luatexko.patch_font")
+otfregister {
+ name = "protrusion",
+ description = "glyph protrusion",
+ default = false,
+ manipulators = {
+ node = process_protrusion,
+ plug = process_protrusion,
+ },
+}
local auxiliary_procs = {
dotemph = {
@@ -2105,11 +2167,9 @@ local auxiliary_procs = {
luatexko_do_atbegshi = process_ruby_post_linebreak,
},
autojosa = {
- luatexko_hpack_first = process_josa,
luatexko_prelinebreak_first = process_josa,
},
reorderTM = {
- luatexko_hpack_first = process_reorder_tonemarks,
luatexko_prelinebreak_first = process_reorder_tonemarks,
},
}
@@ -2151,16 +2211,16 @@ end,
function luatexko.deactivateall (str)
luatexko.deactivated = {}
- for _, name in ipairs{ "hpack_filter",
+ for _, name in ipairs{ "pre_shaping_filter",
+ "post_shaping_filter",
"pre_linebreak_filter",
"hyphenate",
"luatexko_do_atbegshi", -- might not work properly
- "luaotfload.patch_font_unsafe", -- added for harf
- "luaotfload.patch_font" } do
+ } do
local t = {}
- for i, v in ipairs( callback_descriptions(name) ) do
+ for i, v in ipairs( luatexbase.callback_descriptions(name) ) do
if v:find(str or "^luatexko%.") then
- local ff, dd = remove_from_callback(name, v)
+ local ff, dd = luatexbase.remove_from_callback(name, v)
tableinsert(t, { ff, dd, i })
end
end
diff --git a/macros/luatex/generic/luatexko/luatexko.sty b/macros/luatex/generic/luatexko/luatexko.sty
index 958407dc81..f1e0179164 100644
--- a/macros/luatex/generic/luatexko/luatexko.sty
+++ b/macros/luatex/generic/luatexko/luatexko.sty
@@ -1,6 +1,6 @@
% luatexko.sty
%
-% Copyright (c) 2013-2020 Dohyun Kim <nomos at ktug org>
+% Copyright (c) 2013-2021 Dohyun Kim <nomos at ktug org>
% Soojin Nam <jsunam at gmail com>
%
% This work may be distributed and/or modified under the
@@ -13,11 +13,10 @@
\ifdefined\luatexkohangulfontattr \endinput\fi
\ifdefined\selectfont
- \NeedsTeXFormat{LaTeX2e}[2020/02/02]
- \ProvidesPackage{luatexko}[2020/07/27 v2.9 typesetting Korean with LuaTeX]
+ \NeedsTeXFormat{LaTeX2e}[2020/10/01]
+ \ProvidesPackage{luatexko}[2021/03/01 v3.0 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}[2020/02/03]
- \RequirePackage{atbegshi}
\else
\input luatexbase.sty
\input luaotfload.sty
@@ -360,11 +359,6 @@
\ifcase\count@ \directlua{ luatexko.uhc2utf8.stopconvert() }%
\else \directlua{ luatexko.uhc2utf8.startconvert() }%
\fi}
-% actualtext not provided
-\ifdefined\actualtext\else
- \protected\def\actualtext#1#{\luatexkoactualtext}
- \def\luatexkoactualtext#1{#1}
-\fi
% math hangul
\def\setmathhangulblock#1#2{%
\count@="#1
@@ -432,60 +426,60 @@
\catcode`\@=\luatexkoatcatcode
\endinput\fi
% latex
-\RequirePackage{everysel}
-\EverySelectfont{%
- \luatexkohangulselectfont
- \luatexkohanjaselectfont
- \luatexkofallbackselectfont
+\IfHookExistsTF{selectfont}{
+ \AddToHook{selectfont}{%
+ \luatexkohangulselectfont
+ \luatexkohanjaselectfont
+ \luatexkofallbackselectfont }
+}{
+ \RequirePackage{everysel}
+ \EverySelectfont{%
+ \luatexkohangulselectfont
+ \luatexkohanjaselectfont
+ \luatexkofallbackselectfont }
}
-\edef\@rmfamilyhook{\unexpanded\expandafter{\@rmfamilyhook
+\AddToHook{rmfamily}{%
\let\luatexkohangulfont \luatexkomainhangulfont
\let\luatexkohanjafont \luatexkomainhanjafont
\let\luatexkofallbackfont\luatexkomainfallbackfont
-}}
-\edef\@sffamilyhook{\unexpanded\expandafter{\@sffamilyhook
+}
+\AddToHook{sffamily}{%
\let\luatexkohangulfont \luatexkosanshangulfont
\let\luatexkohanjafont \luatexkosanshanjafont
\let\luatexkofallbackfont\luatexkosansfallbackfont
-}}
-\edef\@ttfamilyhook{\unexpanded\expandafter{\@ttfamilyhook
+}
+\AddToHook{ttfamily}{%
\let\luatexkohangulfont \luatexkomonohangulfont
\let\luatexkohanjafont \luatexkomonohanjafont
\let\luatexkofallbackfont\luatexkomonofallbackfont
-}}
-\edef\@defaultfamilyhook{\unexpanded\expandafter{\@defaultfamilyhook
+}
+\AddToHook{normalfont}{%
\let\luatexkohangulfont \luatexkodefaulthangulfont
\let\luatexkohanjafont \luatexkodefaulthanjafont
\let\luatexkofallbackfont\luatexkodefaultfallbackfont
-}}
+}
% fontspec-like
\ExplSyntaxOn
-\cs_new_nopar:Npn \l_luatexko_pacify_bfseries {
+\cs_new_nopar:Npn \l_luatexko_silent_upshape {
\tl_map_inline:nn { \mddefault \bfdefault }
{
\cs_if_exist:cF
{ \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\updefault }
{
- \cs_set_eq:cc
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\updefault }
+ \cs_if_exist:cT
{ \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\shapedefault }
- }
- }
- \tl_map_inline:nn { \shapedefault \updefault \itdefault \sldefault }
- {
- \cs_if_exist:cF
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/bx/##1 }
- {
- \cs_set_eq:cc
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/bx/##1 }
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/\bfdefault/##1 }
+ {
+ \cs_set_eq:cc
+ { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\updefault }
+ { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\shapedefault }
+ }
}
}
}
\DeclareDocumentCommand \setmainhangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainhangulfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainhangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -502,7 +496,7 @@
\DeclareDocumentCommand \setsanshangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosanshangulfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosanshangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -519,7 +513,7 @@
\DeclareDocumentCommand \setmonohangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonohangulfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonohangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -536,7 +530,7 @@
\DeclareDocumentCommand \newhangulfontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkohangulfont
@@ -555,7 +549,7 @@
\DeclareDocumentCommand \hangulfontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkohangulfontfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkohangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -567,7 +561,7 @@
\DeclareDocumentCommand \setmainhanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainhanjafamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainhanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -584,7 +578,7 @@
\DeclareDocumentCommand \setsanshanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosanshanjafamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosanshanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -601,7 +595,7 @@
\DeclareDocumentCommand \setmonohanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonohanjafamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonohanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -618,7 +612,7 @@
\DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkohanjafont
@@ -637,7 +631,7 @@
\DeclareDocumentCommand \hanjafontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkohanjafontfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkohanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -650,7 +644,7 @@
\DeclareDocumentCommand \setmainfallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainfallbackfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainfallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -667,7 +661,7 @@
\DeclareDocumentCommand \setsansfallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosansfallbackfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosansfallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -684,7 +678,7 @@
\DeclareDocumentCommand \setmonofallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonofallbackfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonofallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -701,7 +695,7 @@
\DeclareDocumentCommand \newfallbackfontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkofallbackfont
@@ -720,7 +714,7 @@
\DeclareDocumentCommand \fallbackfontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkofallbackfontfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkofallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -732,7 +726,7 @@
\DeclareDocumentCommand \setmathhangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomathhangulfamily { #1, #3 } { #2 }
- \l_luatexko_pacify_bfseries
+ \l_luatexko_silent_upshape
\DeclareSymbolFont { mathhangul }
\g_fontspec_encoding_tl \luatexkomathhangulfamily \mddefault \updefault
\int_compare:nNnF { \Umathcharfam"AC00 } = { \symmathhangul }
@@ -746,20 +740,14 @@
\let\adhochanjafont\hanjafontspec
\let\adhocfallbackfont\fallbackfontspec
% interhangul, interlatincjk, charraise
-\def\luatexkopacifybfseries{%
+\def\luatexkosilentupshape{%
\@tfor \@tempa := \mddefault \bfdefault \do {%
\ifcsname \f@encoding/\f@family/\@tempa/\updefault\endcsname \else
+ \ifcsname \f@encoding/\f@family/\@tempa/\shapedefault\endcsname
\global \expandafter\let
\csname \f@encoding/\f@family/\@tempa/\updefault \expandafter\endcsname
\csname \f@encoding/\f@family/\@tempa/\shapedefault\endcsname
- \fi
- }%
- \@tfor \@tempa := \shapedefault \updefault \itdefault \sldefault \do {%
- \ifcsname \f@encoding/\f@family/bx/\@tempa\endcsname \else
- \global \expandafter\let
- \csname \f@encoding/\f@family/bx/\@tempa \expandafter\endcsname
- \csname \f@encoding/\f@family/\bfdefault/\@tempa\endcsname
- \fi
+ \fi\fi
}%
}
\protected\def\addhangulfontfeature#1{%
@@ -767,7 +755,7 @@
\ifdefined\luatexkohangulfont
\fontseries\mddefault\fontshape\shapedefault \luatexkohangulfont \fi
\addfontfeature{#1}%
- \luatexkopacifybfseries
+ \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkohangulfont{%
\noexpand\fontencoding{\UTFencname}%
@@ -780,7 +768,7 @@
\ifdefined\luatexkohanjafont
\fontseries\mddefault\fontshape\shapedefault \luatexkohanjafont \fi
\addfontfeature{#1}%
- \luatexkopacifybfseries
+ \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkohanjafont{%
\noexpand\fontencoding{\UTFencname}%
@@ -793,7 +781,7 @@
\ifdefined\luatexkofallbackfont
\fontseries\mddefault\fontshape\shapedefault \luatexkofallbackfont \fi
\addfontfeature{#1}%
- \luatexkopacifybfseries
+ \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkofallbackfont{%
\noexpand\fontencoding{\UTFencname}%
@@ -806,21 +794,7 @@
\newfontfeature{CharRaise}{charraise=#1}
\newfontfeature{RemoveClassicSpaces}{+removeclassicspaces}
\newfontfeature{CompressPunctuations}{+compresspunctuations}
-% luaotfload expansion feature, committed at 2020.06.08
-\count@=\z@
-\directlua{ if luatexko.plug_expansion_loaded then tex.setcount(255,1) end }
-\ifnum\count@=\z@
- \newfontfeature{Expansion}{expansion=\ifx\empty#1\empty default\else #1\fi }
-\else
- \newfontfeature{Expansion}{expansion=\directlua{
- if "#1" == "" or "#1" == "default" then
- tex.sprint "20 20 5"
- else
- tex.sprint "#1"
- end
- }%
- }
-\fi
+\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}
@@ -854,7 +828,22 @@
\begingroup\ttfamily
\directlua{ luatexko.currenthashangulchars(255) }\expandafter\endgroup
\ifnum\count@=\z@
- \let\luatexkomonohangulfont\luatexkosanshangulfont
+ \def\@tempa{lmtt}\def\@tempb{LatinModernMono(0)}
+ \ifnum 0\ifx\ttdefault\@tempa 1\else\ifx\ttdefault\@tempb 1\fi\fi >\z@
+ \IfFontExistsTF{UnDotum.ttf}
+ {\setmonohangulfont{UnDotum}[
+ UprightFeatures={SizeFeatures={
+ {Size={-8.5}, FakeStretch=1.062},
+ {Size={8.5-11}, FakeStretch=1.05 },
+ {Size={11-}, FakeStretch=1.03 }}},
+ BoldFeatures={SizeFeatures={
+ {Size={-}, FakeStretch=1.05}}},
+ WordSpace={1.66667,0,0}]
+ }
+ {\let\luatexkomonohangulfont\luatexkosanshangulfont }
+ \else
+ \let\luatexkomonohangulfont\luatexkosanshangulfont
+ \fi
\fi
\fi
% just in case, reset luatexkodefault...font
diff --git a/macros/luatex/generic/luavlna/README.md b/macros/luatex/generic/luavlna/README.md
index de38ed0c67..eb5fb3d0d0 100644
--- a/macros/luatex/generic/luavlna/README.md
+++ b/macros/luatex/generic/luavlna/README.md
@@ -1,4 +1,4 @@
-# Luavlna, version 0.1h, 2021-01-08
+# Luavlna, version 0.1i, 2021-03-02
# Introduction
diff --git a/macros/luatex/generic/luavlna/luavlna-doc.pdf b/macros/luatex/generic/luavlna/luavlna-doc.pdf
index 40cca34546..b37ab16b77 100644
--- a/macros/luatex/generic/luavlna/luavlna-doc.pdf
+++ b/macros/luatex/generic/luavlna/luavlna-doc.pdf
Binary files differ
diff --git a/macros/luatex/generic/luavlna/luavlna-doc.tex b/macros/luatex/generic/luavlna/luavlna-doc.tex
index 20a83ae127..470822d4ac 100644
--- a/macros/luatex/generic/luavlna/luavlna-doc.tex
+++ b/macros/luatex/generic/luavlna/luavlna-doc.tex
@@ -36,7 +36,7 @@
\section{Introduction}
-This is a small package for plain Lua\TeX and Lua\LaTeX. In some languages, like
+This is a small package for Plain Lua\TeX and Lua\LaTeX. In some languages, like
Czech or Polish, there should be no single letter words at the line
end, according to the typographical norms. There exists some
external commands (like \verb!vlna!) or packages (\verb!encxvlna!
@@ -144,6 +144,20 @@ The \verb|luavlna| package recognizes the following options
\item[\texttt{defaults}] -- load default settings. Enabled by default.
\end{description}
+
+\section{Default values}
+
+Luavlna defines default settings for Czech and Slovak. If you want to disable them,
+you can use the \texttt{defaults=false} option for Luavlna package. In Plain Lua\TeX{},
+use:
+
+\begin{mycode}
+\begin{verbatim}
+\let\nosingledefaults\relax
+\input luavlna
+\end{verbatim}
+\end{mycode}
+
\section{Commands}
\begin{mycode}
@@ -165,6 +179,7 @@ Default values:
\end{verbatim}
\end{mycode}
+
%By default, all
%single letters are processed, this command can be used to pass a
%string of characters, which should be processed only.
@@ -224,7 +239,7 @@ settings for one language for a whole document, you can use following command:
\subsection{Turning off processing}
-If you want to stop processing of the spaces in the document you can use command
+If you want to stop the processing of spaces in the document you can use the following command:
\begin{mycode}
\cmd{\preventsingleoff}
diff --git a/macros/luatex/generic/luavlna/luavlna.sty b/macros/luatex/generic/luavlna/luavlna.sty
index 89e6d47543..31fb0ba438 100644
--- a/macros/luatex/generic/luavlna/luavlna.sty
+++ b/macros/luatex/generic/luavlna/luavlna.sty
@@ -1,4 +1,4 @@
-\ProvidesPackage{luavlna}[2021-01-08 luavlna]
+\ProvidesPackage{luavlna}[2021-03-02 luavlna]
\RequirePackage{kvoptions}
@@ -23,7 +23,7 @@
\def\enablesplithyphens#1{%
\ifcsname l@#1\endcsname%
- \typeout{set lang #1, \the\csname l@#1\endcsname}
+ \typeout{set lang #1, \the\csname l@#1\endcsname}%
\directlua{enable_split_hyphens("\the\csname l@#1\endcsname")}%
\fi%
}
diff --git a/macros/luatex/generic/luavlna/luavlna.tex b/macros/luatex/generic/luavlna/luavlna.tex
index ab47b8d6fc..dd7415534d 100644
--- a/macros/luatex/generic/luavlna/luavlna.tex
+++ b/macros/luatex/generic/luavlna/luavlna.tex
@@ -51,7 +51,7 @@ set_compounds = function(lang, compounds)
end
set_main_language = function(lang)
- local langid = languages:get_number(lang)
+ local langid = get_lang_id(lang)
if not langid then return nil, "Cannot find language number for: "..lang end
luavlna.set_main_language(langid)
end
@@ -69,22 +69,33 @@ disable_split_hyphens = function(lang)
end
}
+% the langno library supports both numeric and literal names
+% we can try to find the language ID from macros first, if it fails
+% we pass the language name to Lua. it will try to find ID in luanguage.dat and other sources
+\def\singlecharsgetlang#1{%
+ \ifcsname lang@#1\endcsname%
+ \the\csname lang@#1\endcsname%
+ \else% unknown language macro, let langno library to find it
+ #1%
+ \fi%
+}
+
% Set letters which are prevented from breaking
\def\singlechars#1#2{%
-\directlua{set_singlechars("#1","#2")}
+ \directlua{set_singlechars("\singlecharsgetlang{#1}","#2")}%
}
% Define compound initials
\def\compoundinitials#1#2{%
-\directlua{set_compounds("#1","#2")}
+ \directlua{set_compounds("\singlecharsgetlang{#1}","#2")}%
}
% Enable inserting of visual marks for debugging
\def\preventsingledebugon{%
-\directlua{luavlna.debug(true)}
+\directlua{luavlna.debug(true)}%
}
\def\preventsinglelang#1{%
- \directlua{set_main_language("#1")}
+ \directlua{set_main_language("\singlecharsgetlang{#1}")}%
}
%\newluatexattribute\preventsinglestatus
@@ -94,18 +105,18 @@ end
\preventsinglestatus=2
}
-\def\preventsingleoff{
+\def\preventsingleoff{%
\preventsinglestatus=1
}
% Disable inserting of visual marks for dewbugging
\def\preventsingledebugoff{%
-\directlua{luavlna.debug(false)}
+\directlua{luavlna.debug(false)}%
}
% enable/disable split hyphens for a language
-\def\enablesplithyphens#1{\directlua{enable_split_hyphens("#1")}}
-\def\disablesplithyphens#1{\directlua{disable_split_hyphens("#1")}}
+\def\enablesplithyphens#1{\directlua{enable_split_hyphens("\singlecharsgetlang{#1}")}}
+\def\disablesplithyphens#1{\directlua{disable_split_hyphens("\singlecharsgetlang{#1}")}}
% disable processing of units or degrees