% lua-widow-control
% https://github.com/gucci-on-fleek/lua-widow-control
% SPDX-License-Identifier: MPL-2.0+
% SPDX-FileCopyrightText: 2021 gucci-on-fleek

\wlog{lua-widow-control v1.0.0} %%version

\input ltluatex % \LuaTeX{}Base

\clubpenalty=1
\widowpenalty=1
\displaywidowpenalty=0
\interlinepenalty=0
\brokenpenalty=0

\newdimen\lwcemergencystretch
\lwcemergencystretch=3em

\directlua{require "lua-widow-control"}

% Here, we enable font expansion/contraction. It isn't strictly necessary for
% \lwc/'s functionality; however, it is required for the
% lengthened paragraphs to not have terrible spacing. 
\expandglyphsinfont\the\font 20 20 5
\adjustspacing=2

\def\lwcenable{\directlua{lwc.enable_callbacks()}}
\def\lwcdisable{\directlua{lwc.disable_callbacks()}}

% Enable \lwc/ by default when the package is loaded.
\lwcenable

\endinput
