diff options
author | Karl Berry <karl@freefriends.org> | 2023-09-11 21:18:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-09-11 21:18:30 +0000 |
commit | ea288d50ee0c4eca33d628d645c3087109cd21bc (patch) | |
tree | ea62d1855054c4a0da7c9d4d61ee500d59a7b60e /Master/texmf-dist/tex/luatex/luatexko | |
parent | ae083fc25ee9fdf450d486d4f890261f40deebb9 (diff) |
luatexko (11sep23)
git-svn-id: svn://tug.org/texlive/trunk@68243 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko')
4 files changed, 66 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua index 68e9227c386..7e736a5b184 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua +++ b/Master/texmf-dist/tex/luatex/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/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua index 5d5fed591fc..e39ae38f768 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua +++ b/Master/texmf-dist/tex/luatex/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/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua index 940efb43c32..addcf4d8176 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua +++ b/Master/texmf-dist/tex/luatex/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/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty index 0cedb2a5d85..fa74b68c28d 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty +++ b/Master/texmf-dist/tex/luatex/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 } |