Skip to content

Commit

Permalink
feat: stroke-length for block and iiiblock bg
Browse files Browse the repository at this point in the history
  • Loading branch information
LogCreative committed Jul 3, 2023
1 parent 37d5dee commit 5fb4c54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions source/pretbg.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
% \TemplateKey{stroke}{boolean}{if there is a block underline}{false}
% \TemplateKey{stroke-color}{tokenlist}{stroke color}{black}
% \TemplateKey{stroke-linewidth}{length}{stroke linewidth}{1pt}
% \TemplateKey{stroke-length}{length}{stroke length}{\cs{paperwidth}}
% \TemplateSemantics blocked headline.\\
% \previewtest{block}
% \begin{macrocode}
Expand All @@ -70,7 +71,8 @@
fill-color : tokenlist = black!20 ,
stroke : boolean = false ,
stroke-color : tokenlist = black ,
stroke-linewidth : length = 1pt
stroke-linewidth : length = 1pt ,
stroke-length : length = \paperwidth
}
%</block|iiiblock>
% \end{macrocode}
Expand All @@ -88,8 +90,8 @@
% variable like \cs{tl_new:N} requires the variable is not declared before, and
% the \pkg{docstrip} is not smart enough to replace \texttt{@@} into the
% corresponding namespaces (\texttt{@@} will always affecting the contents below
% until the next \texttt{@@} declaration), all the implementation will be rolled
% up to avoid the re-declaration variable issue.
% until the next \texttt{@@} declaration), all the implementation will be
% separated to avoid the re-declaration variable issue.
% \end{texnote}
%
% \paragraph{\pkg{default} style.}
Expand All @@ -109,14 +111,16 @@
\bool_new:N \l_@@_bg_headline_stroke_bool
\tl_new:N \l_@@_bg_headline_stroke_color_tl
\dim_new:N \l_@@_bg_headline_stroke_linewidth_dim
\dim_new:N \l_@@_bg_headline_stroke_length_dim
\dim_new:N \l_@@_bg_headline_height_dim
\DeclareTemplateCode { background / headline } { block } { 0 }
{
fill = \l_@@_bg_headline_fill_bool ,
fill-color = \l_@@_bg_headline_fill_color_tl ,
stroke = \l_@@_bg_headline_stroke_bool ,
stroke-color = \l_@@_bg_headline_stroke_color_tl ,
stroke-linewidth = \l_@@_bg_headline_stroke_linewidth_dim
stroke-linewidth = \l_@@_bg_headline_stroke_linewidth_dim ,
stroke-length = \l_@@_bg_headline_stroke_length_dim
}
{
\AssignTemplateKeys
Expand All @@ -134,7 +138,7 @@
\exp_args:NV \color_select:n \l_@@_bg_headline_stroke_color_tl
\linethickness { \dim_use:N \l_@@_bg_headline_stroke_linewidth_dim }
\put (0, - \dim_use:N \l_@@_bg_headline_height_dim )
{ \line ( 1 , 0 ) { \paperwidth } }
{ \line ( 1 , 0 ) { \dim_use:N \l_@@_bg_headline_stroke_length_dim } }
}
}
%</block>
Expand All @@ -150,14 +154,16 @@
\bool_new:N \l_@@_bg_headline_stroke_bool
\tl_new:N \l_@@_bg_headline_stroke_color_tl
\dim_new:N \l_@@_bg_headline_stroke_linewidth_dim
\dim_new:N \l_@@_bg_headline_stroke_length_dim
\dim_new:N \l_@@_bg_headline_height_dim
\DeclareTemplateCode { background / headline } { iiiblock } { 0 }
{
fill = \l_@@_bg_headline_fill_bool ,
fill-color = \l_@@_bg_headline_fill_color_tl ,
stroke = \l_@@_bg_headline_stroke_bool ,
stroke-color = \l_@@_bg_headline_stroke_color_tl ,
stroke-linewidth = \l_@@_bg_headline_stroke_linewidth_dim
stroke-linewidth = \l_@@_bg_headline_stroke_linewidth_dim ,
stroke-length = \l_@@_bg_headline_stroke_length_dim
}
{
\AssignTemplateKeys
Expand All @@ -178,7 +184,7 @@
{
\draw_linewidth:n { \l_@@_bg_headline_stroke_linewidth_dim }
\draw_path_moveto:n { 0pt , 0pt }
\draw_path_lineto:n { \paperwidth, 0pt }
\draw_path_lineto:n { \l_@@_bg_headline_stroke_length_dim, 0pt }
\exp_args:NV \color_select:n \l_@@_bg_headline_stroke_color_tl
\draw_path_use_clear:n { stroke }
}
Expand Down
2 changes: 1 addition & 1 deletion testfiles/block.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\input{regression-test}
\documentclass{presenter}
\LoadPresenterBackground{block}
\EditInstance{background/headline}{base}{stroke=true}
\EditInstance{background/headline}{base}{stroke=true,stroke-length=0.5\paperwidth}
\begin{document}
\START

Expand Down

0 comments on commit 5fb4c54

Please sign in to comment.