summaryrefslogtreecommitdiff
path: root/macros/luatex/generic
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-09-12 03:01:04 +0000
committerNorbert Preining <norbert@preining.info>2023-09-12 03:01:04 +0000
commitbecf79ac9bbdddd15ef9d66a35c6d64252a2cd46 (patch)
tree8d5a60061f6aef780c147dcc82674a5652be9b75 /macros/luatex/generic
parentf2abd8392e16d9b51a73c3c09b322ddde8b9be9e (diff)
CTAN sync 202309120301
Diffstat (limited to 'macros/luatex/generic')
-rw-r--r--macros/luatex/generic/luatexko/ChangeLog8
-rw-r--r--macros/luatex/generic/luatexko/README2
-rw-r--r--macros/luatex/generic/luatexko/luatexko-doc.pdfbin339436 -> 339895 bytes
-rw-r--r--macros/luatex/generic/luatexko/luatexko-doc.tex2
-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.lua90
-rw-r--r--macros/luatex/generic/luatexko/luatexko.sty19
8 files changed, 76 insertions, 57 deletions
diff --git a/macros/luatex/generic/luatexko/ChangeLog b/macros/luatex/generic/luatexko/ChangeLog
index 6cffa0112e..d5a7ea3408 100644
--- a/macros/luatex/generic/luatexko/ChangeLog
+++ b/macros/luatex/generic/luatexko/ChangeLog
@@ -1,3 +1,11 @@
+2023-09-11 Dohyun Kim <nomos at ktug org>
+
+ Version 3.6
+
+ * luatexko.lua:
+ - prevent possible error in vertical writing mode
+ - more precise space_skip after hangul characters
+
2022-11-01 Dohyun Kim <nomos at ktug org>
Version 3.5
diff --git a/macros/luatex/generic/luatexko/README b/macros/luatex/generic/luatexko/README
index 1cfabaf261..3dd7f3c4c4 100644
--- a/macros/luatex/generic/luatexko/README
+++ b/macros/luatex/generic/luatexko/README
@@ -1,4 +1,4 @@
-LuaTeX-ko Package version 3.5 (2022/11/01)
+LuaTeX-ko Package version 3.6 (2023/09/11)
===========================================
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 351e5397a7..ae15171153 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 ddec12b794..18e05b2866 100644
--- a/macros/luatex/generic/luatexko/luatexko-doc.tex
+++ b/macros/luatex/generic/luatexko/luatexko-doc.tex
@@ -142,7 +142,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 3.5\quad 2022/11/01}
+\date{Version 3.6\quad 2023/09/11}
\maketitle
\begin{quote}
diff --git a/macros/luatex/generic/luatexko/luatexko-normalize.lua b/macros/luatex/generic/luatexko/luatexko-normalize.lua
index 68e9227c38..7e736a5b18 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-2022 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2023 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 = "3.5",
- date = "2022/11/01",
+ version = "3.6",
+ date = "2023/09/11",
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 5d5fed591f..e39ae38f76 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-2022 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2023 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 = "3.5",
- date = "2022/11/01",
+ version = "3.6",
+ date = "2023/09/11",
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 940efb43c3..addcf4d817 100644
--- a/macros/luatex/generic/luatexko/luatexko.lua
+++ b/macros/luatex/generic/luatexko/luatexko.lua
@@ -1,6 +1,6 @@
-- luatexko.lua
--
--- Copyright (c) 2013-2022 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2023 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 = '2022/11/01',
- version = '3.5',
+ date = '2023/09/11',
+ version = '3.6',
description = 'typesetting Korean with LuaTeX',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -304,7 +304,7 @@ local fontoptions = {
if has_harf_data(fid) then
newwd = getparameters(fid) or false
if newwd then
- newwd = { newwd.space, newwd.space_stretch, newwd.space_shrink }
+ newwd = { newwd.space, newwd.space_stretch, newwd.space_shrink, newwd.extra_space }
end
else
local newsp = nodenew(glyphid)
@@ -312,7 +312,7 @@ local fontoptions = {
newsp = nodes.simple_font_handler(newsp)
newwd = newsp and newsp.width or false
if newwd then
- newwd = { texsp(newwd), texsp(newwd/2), texsp(newwd/3) }
+ newwd = { texsp(newwd), texsp(newwd/2), texsp(newwd/3), texsp(newwd/3) }
end
if newsp then nodefree(newsp) end
end
@@ -668,40 +668,12 @@ function luatexko.updateforcehangul (value)
nodewrite(what)
end
-local function hangul_space_skip (curr, newfont)
- if curr.lang ~= nohyphen and curr.font ~= newfont then
- -- 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 fontoptions.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 = fontoptions.hangulspaceskip[newfont]
- if newwd then
- setglue(n, newwd[1], newwd[2], newwd[3])
- end
- end
- end
- end
- end
-end
-
local function process_fonts (head)
- local curr = head
+ local curr, currfont, currlang, newfont = head, 0, nohyphen, 0
while curr do
local id = curr.id
if id == glyphid then
+ currfont, currlang = curr.font, curr.lang
if curr.font ~= 0 -- exclude nullfont
and not has_attribute(curr, unicodeattr) then
@@ -712,7 +684,6 @@ local function process_fonts (head)
local p = getprev(curr)
if p and p.id == glyphid then
if curr.font ~= p.font then
- hangul_space_skip(curr, p.font)
curr.font = p.font
end
curr.lang = p.lang
@@ -747,16 +718,13 @@ local function process_fonts (head)
then
curr.font = hf
elseif hf and has_attribute(curr, hangulbyhangulattr) and is_hangul_jamo(c) then
- hangul_space_skip(curr, hf)
curr.font = hf
elseif hjf and has_attribute(curr, hanjabyhanjaattr) and is_hanja(c) then
- hangul_space_skip(curr, hjf)
curr.font = hjf
elseif not char_in_font(curr.font, c) then
local fbf = has_attribute(curr, fallbackfontattr) or false
for _,f in ipairs{ hf, hjf, fbf } do
if f and char_in_font(f, c) then
- hangul_space_skip(curr, f)
curr.font = f
break
end
@@ -765,6 +733,46 @@ local function process_fonts (head)
set_attribute(curr, unicodeattr, c)
end
end
+ newfont = curr.font
+ elseif id == glueid
+ and currfont ~= 0
+ and currfont ~= newfont
+ and currlang ~= nohyphen
+ and curr.subtype == spaceskip
+ -- 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
+ and not fontoptions.monospaced[currfont] then
+
+ local params = getparameters(currfont)
+ local oldwd, oldst, oldsh, oldsto, oldsho = getglue(curr)
+ if params and oldsto == 0 and oldsho == 0 then
+ local p = getprev(curr)
+ local sf = p and p.char and tex.getsfcode(p.char) or 1000
+ if sf == 0 or sf > 1000 then
+ local p, pf = getprev(p), 0
+ while p and pf == 0 do
+ pf = p.char and tex.getsfcode(p.char) or 1000
+ p = getprev(p)
+ end
+ if sf == 0 then sf = pf end
+ if pf < 1000 then sf = 1000 end
+ end
+ if oldwd == (sf < 2000 and params.space or params.space+params.extra_space)
+ and oldst == texsp(params.space_stretch * (sf/1000))
+ and oldsh == texsp(params.space_shrink * (1000/sf)) then
+
+ local newwd = fontoptions.hangulspaceskip[newfont]
+ if newwd then
+ setglue(curr,
+ sf < 2000 and newwd[1] or newwd[1]+newwd[4],
+ texsp(newwd[2] * (sf/1000)),
+ texsp(newwd[3] * (1000/sf)))
+ end
+ end
+ end
elseif id == discid then
process_fonts(curr.pre)
process_fonts(curr.post)
@@ -1911,7 +1919,7 @@ local function process_vertical_font (fontdata)
local voff = goffset - (v.width or 0)/2
local bbox = descriptions[i] and descriptions[i].boundingbox or {0,0,0,0}
local gid = v.index
- local tsb = tsb_tab[gid].tsb
+ local tsb = tsb_tab[gid] and tsb_tab[gid].tsb
local hoff = tsb and (bbox[4] + tsb) * scale or ascender
v.commands = {
{ "down", -voff },
@@ -1922,7 +1930,7 @@ local function process_vertical_font (fontdata)
{ "pop" },
{ "pdf", "Q" },
}
- local vw = tsb_tab[gid].ht
+ local vw = tsb_tab[gid] and tsb_tab[gid].ht
v.width = vw and vw * scale or quad
local ht = bbox[3] * scale + voff
local dp = bbox[1] * scale + voff
diff --git a/macros/luatex/generic/luatexko/luatexko.sty b/macros/luatex/generic/luatexko/luatexko.sty
index 0cedb2a5d8..fa74b68c28 100644
--- a/macros/luatex/generic/luatexko/luatexko.sty
+++ b/macros/luatex/generic/luatexko/luatexko.sty
@@ -1,6 +1,6 @@
% luatexko.sty
%
-% Copyright (c) 2013-2022 Dohyun Kim <nomos at ktug org>
+% Copyright (c) 2013-2023 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 @@
\ifdefined\luatexkohangulfontattr \endinput\fi
\ifdefined\ProvidesPackage
- \NeedsTeXFormat{LaTeX2e}[2021/06/01]
- \ProvidesPackage{luatexko}[2022/11/01 v3.5 typesetting Korean with LuaTeX]
+ \NeedsTeXFormat{LaTeX2e}[2021/11/15]
+ \ProvidesPackage{luatexko}[2023/09/11 v3.6 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}[2020/02/03]
\let\luatexkoselectfont\selectfont
@@ -229,6 +229,9 @@
\global\advance\luatexkoulinecount\@ne
\ifnum\luatexkoulinecount=\@ne \directlua{ luatexko.activate"uline" }\fi
\begingroup
+ \ifx\luatexko@prev@ulinedown\ulinedown
+ \edef\ulinedown{\dimexpr\ulinedown+\ulinewidth+.15ex\relax}\fi
+ \let\luatexko@prev@ulinedown\ulinedown
\count@=\luatexkoulinecount
\leavevmode
\setbox\z@\hbox{#1}%
@@ -933,8 +936,9 @@
\let\luatexkodefaulthanjafont \luatexkomainhanjafont
\let\luatexkodefaultfallbackfont\luatexkomainfallbackfont
\fi\fi
- % hyperref
- \@ifpackageloaded{hyperref}{\pdfstringdefDisableCommands{%
+}
+% hyperref
+\AddToHook{package/hyperref/after}{\pdfstringdefDisableCommands{%
\let\ruby\@firstoftwo
\let\xxruby\@firstoftwo
\let\dotemph\@firstofone
@@ -966,9 +970,8 @@
\let\addfallbackfontfeatures\@gobble
\def\는{는}\def\은{은}\def\을{을}\def\를{를}\def\와{와}\def\과{과}%
\def\가{가}\def\이{이}\def\라{라}\def\으{으}\def\로{로}%
- \def\hellipsis{...}}}{}
- \@ifpackageloaded{pxrubrica}{\let\ruby\jruby}{}
-}
+ \def\hellipsis{...}}}
+\AddToHook{package/pxrubrica/after}{\let\ruby\jruby}
% misc
\RequirePackage{kolabels-utf}
\protected\def\hellipsis{\char"2026\char"2026 }