From ea6d4bea686850292393a94755801b76ef66ec22 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Tue, 28 Jul 2020 03:01:51 +0000
Subject: CTAN sync 202007280301

---
 macros/luatex/generic/luatexko/luatexko.sty | 48 +++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 13 deletions(-)

(limited to 'macros/luatex/generic/luatexko/luatexko.sty')

diff --git a/macros/luatex/generic/luatexko/luatexko.sty b/macros/luatex/generic/luatexko/luatexko.sty
index f96b228a2c..958407dc81 100644
--- a/macros/luatex/generic/luatexko/luatexko.sty
+++ b/macros/luatex/generic/luatexko/luatexko.sty
@@ -14,7 +14,7 @@
 \ifdefined\luatexkohangulfontattr \endinput\fi
 \ifdefined\selectfont
   \NeedsTeXFormat{LaTeX2e}[2020/02/02]
-  \ProvidesPackage{luatexko}[2020/03/20 v2.8 typesetting Korean with LuaTeX]
+  \ProvidesPackage{luatexko}[2020/07/27 v2.9 typesetting Korean with LuaTeX]
   \RequirePackage{luatexbase}
   \RequirePackage{fontspec}[2020/02/03]
   \RequirePackage{atbegshi}
@@ -38,16 +38,23 @@
 \newattribute\luatexkohangulbyhangulattr
 \newattribute\luatexkohanjabyhanjaattr
 \directlua{ require"luatexko" }
-\edef\AtBegShi@Hook{% occupy the first position
-  \unexpanded{%
-    \AtBegShi@Item{%
-      \directlua{%
-        luatexko.process_atbegshi(tex.getbox(\the\AtBeginShipoutBox))
+\ifdefined\AtBegShi@Hook
+  \edef\AtBegShi@Hook{% occupy the first position
+    \unexpanded{%
+      \AtBegShi@Item{%
+        \directlua{%
+          luatexko.process_atbegshi(tex.getbox(\the\AtBeginShipoutBox))
+        }%
       }%
     }%
-  }%
-  \unexpanded\expandafter{\AtBegShi@Hook}%
-}
+    \unexpanded\expandafter{\AtBegShi@Hook}%
+  }
+\else
+  \AddToHook{shipout/before}{%
+    \directlua{ luatexko.process_atbegshi(tex.getbox(\the\ShipoutBox)) }%
+  }
+  \DeclareHookRule{shipout/before}{.}{before}{luacolor}
+\fi
 % classic
 \protected\def\typesetclassic{\luatexkoclassicattr\z@\parindent1em }
 \protected\def\typesetvertical{\luatexkoclassicattr\@ne\parindent1em }
@@ -301,17 +308,18 @@
       \pdfliteral{q 0 -1 1 0 0 0 cm}\box#1\pdfliteral{Q}%
       \vfil }}}
 % horizontal box inside vertical writing
-\def\luatexkohorizboxmoveleft{0.5ex}
+\def\luatexkohorizboxmoveright{0.5ex}
 \protected\def\horizontal#1{%
-  \directlua{ luatexko.gethorizboxmoveleft() }%
+  \directlua{ luatexko.gethorizboxmoveright() }%
   \leavevmode
   \setbox\z@\vbox\bgroup
     \hsize#1\relax
     \typesetmodern }
 \protected\def\endhorizontal{%
   \egroup
+  \dimen@=\dimexpr.5\wd\z@-\luatexkohorizboxmoveright\relax
   \luatexkounrotatebox\z@
-  \lower\luatexkohorizboxmoveleft\box\z@ }
+  \lower\dimen@\box\z@ }
 \protected\def\luatexkounrotatebox#1{%
   \setbox#1\hbox to\dimexpr\ht#1+\dp#1{%
     \vbox to\wd#1{%
@@ -798,7 +806,21 @@
 \newfontfeature{CharRaise}{charraise=#1}
 \newfontfeature{RemoveClassicSpaces}{+removeclassicspaces}
 \newfontfeature{CompressPunctuations}{+compresspunctuations}
-\newfontfeature{Expansion}{expansion=\ifx\empty#1\empty default\else #1\fi }
+% 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{Protrusion}{protrusion=\ifx\empty#1\empty default\else #1\fi }
 \newfontfeature{InterCharacter}{intercharacter=#1}
 \newfontfeature{InterCharStretch}{intercharstretch=#1}
-- 
cgit v1.2.3

