summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexko/luatexko.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/luatexko/luatexko.sty')
-rw-r--r--macros/luatex/generic/luatexko/luatexko.sty59
1 files changed, 45 insertions, 14 deletions
diff --git a/macros/luatex/generic/luatexko/luatexko.sty b/macros/luatex/generic/luatexko/luatexko.sty
index dd25d17b77..f96b228a2c 100644
--- a/macros/luatex/generic/luatexko/luatexko.sty
+++ b/macros/luatex/generic/luatexko/luatexko.sty
@@ -14,12 +14,14 @@
\ifdefined\luatexkohangulfontattr \endinput\fi
\ifdefined\selectfont
\NeedsTeXFormat{LaTeX2e}[2020/02/02]
- \ProvidesPackage{luatexko}[2020/03/14 v2.7 typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko}[2020/03/20 v2.8 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}[2020/02/03]
+ \RequirePackage{atbegshi}
\else
\input luatexbase.sty
\input luaotfload.sty
+ \input atbegshi.sty
\chardef\luatexkoatcatcode=\catcode`\@
\catcode`\@=11
\fi
@@ -31,10 +33,21 @@
\newattribute\luatexkoautojosaattr
\newattribute\luatexkoclassicattr
\newattribute\luatexkodotemphattr
+\newattribute\luatexkoulineattr
\newattribute\luatexkorubyattr \chardef\luatexkorubyalloc\allocationnumber
\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))
+ }%
+ }%
+ }%
+ \unexpanded\expandafter{\AtBegShi@Hook}%
+}
% classic
\protected\def\typesetclassic{\luatexkoclassicattr\z@\parindent1em }
\protected\def\typesetvertical{\luatexkoclassicattr\@ne\parindent1em }
@@ -133,8 +146,11 @@
\setbox\z@\hbox{\raise\dotemphraise\hbox{\dotemphchar}}%
\directlua{
if \the\luatexkodotemphcount == 1 then luatexko.activate("dotemph") end
- luatexko.dotemphbox[\the\luatexkodotemphcount] = node.copy(tex.box[0].list)
+ luatexko.dotemphbox[\the\luatexkodotemphcount] = node.copy(tex.box[0])
}\luatexkodotemphattr\luatexkodotemphcount #1%
+ \directlua{
+ luatexko.dotemphboundary(\the\luatexkodotemphattr)
+ }%
\endgroup }
% uline
\newcount\luatexkoulinecount
@@ -149,18 +165,17 @@
\def\luatexkomarkoverwith#1#2{%
\global\advance\luatexkoulinecount\@ne
\begingroup
- \count@\luatexkoulinecount
- \ifx\luatexkoulinerunning\relax
- \edef\ulinedown{\the\dimexpr\ulinedown+\ulinewidth+.15ex\relax}\fi
- \let\luatexkoulinerunning\relax
\leavevmode
\setbox\z@\hbox{#1}%
\directlua{
if \the\luatexkoulinecount == 1 then luatexko.activate("uline") end
- luatexko.ulboundary(\the\count@, tex.box[0].list, \luatexkoleaderstype)
- }#2\relax
+ luatexko.ulboundary(\the\luatexkoulinecount,
+ tex.box[0].list,
+ \luatexkoleaderstype)
+ }%
+ \luatexkoulineattr\luatexkoulinecount #2\relax
\directlua{
- luatexko.ulboundary(\the\count@)
+ luatexko.ulboundary(\the\luatexkoulineattr)
}\endgroup }
\protected\def\uline{\markoverwith{%
\vrule width\z@ height-\ulinedown depth\dimexpr\ulinedown+\ulinewidth\relax }}
@@ -170,13 +185,29 @@
\kern.125em }}}
\protected\def\dotuline{\markoverwith*{%
\lower\dimexpr\ulinedown+.2ex\relax\hbox{\kern.07em .\kern.07em }}}
-\protected\def\uuline#1{\uline{\uline{#1}}}
-\protected\def\sout#1{\begingroup
+\protected\def\uuline{\markoverwith{%
+ \lower\ulinedown\vtop{%
+ \hrule width .2em height\z@ depth\ulinewidth
+ \kern .15ex
+ \hrule width .2em height\z@ depth\ulinewidth
+ }%
+}}
+\protected\def\sout#1{%
+ \begingroup
\setbox\z@\hbox{#1}%
- \edef\ulinedown{\the\dimexpr
+ \edef\soutdown{%
+ \the\dimexpr
\directlua{ tex.sprint(luatexko.get_strike_out_down(tex.box[0])) }sp
- -.5\dimexpr\ulinewidth\relax \relax }%
- \uline{#1}\endgroup}
+ -.5\dimexpr\ulinewidth\relax \relax
+ }%
+ \markoverwith{%
+ \vrule width \z@
+ height-\soutdown
+ depth \dimexpr\soutdown+\ulinewidth\relax
+ }%
+ {#1}%
+ \endgroup
+}
\protected\def\xout{\markoverwith{\hbox to.4em{\hss/\hss}}}
\protected\def\uwave{\font\luatexkofontsixly=lasy6\relax
\markoverwith{\lower4\p@\hbox{\luatexkofontsixly\char58}}}