summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-04-21 20:15:20 +0000
committerKarl Berry <karl@freefriends.org>2024-04-21 20:15:20 +0000
commit3110e4fa3dff1aebd4f9e6604757dcb865afa684 (patch)
tree9f4dfaab79a3d91450014b3386d9d9e4a1b2da77
parent022cbb064e6454af6d55af26215695a430ee1c6b (diff)
fontscale (21apr24)
git-svn-id: svn://tug.org/texlive/trunk@71029 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md7
-rw-r--r--Master/texmf-dist/doc/latex/fontscale/beery.cls5
-rw-r--r--Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdfbin131367 -> 117119 bytes
-rw-r--r--Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex26
-rw-r--r--Master/texmf-dist/tex/latex/fontscale/fontscale.sty147
5 files changed, 89 insertions, 96 deletions
diff --git a/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md b/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
index 802fb374ef1..304749e8253 100644
--- a/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
+++ b/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
@@ -7,6 +7,13 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v1.2.1] - 2024-04-21
+
+### Changed
+- Improved the error message for `\SetFontStep*` when the current font step is
+ undefined.
+- Documentation improvements.
+
## [v1.2.0] - 2024-04-15
### Added
diff --git a/Master/texmf-dist/doc/latex/fontscale/beery.cls b/Master/texmf-dist/doc/latex/fontscale/beery.cls
index bfc38f9a59f..4777c06a8ef 100644
--- a/Master/texmf-dist/doc/latex/fontscale/beery.cls
+++ b/Master/texmf-dist/doc/latex/fontscale/beery.cls
@@ -4,13 +4,14 @@
\NeedsTeXFormat{LaTeX2e}[2023-06-01]
\ProvidesExplClass
{beery}
- {2024-04-15}
+ {2024-04-21}
{}
{}
\RequirePackage { fix-cm }
\LoadClass { article }
\RequirePackage { fontscale }
+\fontscalesetup { musical }
\RequirePackage [ list-final-separator = { ,~ and~ } ] { siunitx }
\RequirePackage { mathtools }
\RequirePackage [ shortcuts , allowbreakbefore ] { extdash }
@@ -179,7 +180,7 @@
\NewDocumentCommand \KeepNextPar { s }
{
\par
- \bool_if:NTF #1
+ \IfBooleanTF #1
{ \int_compare:nNnT { \prevgraf } = { 1 } { \nobreak \@afterheading } }
{ \nobreak \@afterheading }
}
diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf
index a1c5644e607..c21ffd29a99 100644
--- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf
+++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex
index ca5b3224fd0..db839a0fd21 100644
--- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex
+++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex
@@ -13,7 +13,7 @@ A user interface for setting document font sizes
Oliver Beery
-Version 1.2.0\quad{}15 April 2024
+Version 1.2.1\quad{}21 April 2024
\section{Introduction}
@@ -167,13 +167,13 @@ Note that the font steps and the scale of \cs{normalsize} are constants and cann
\Key{\meta{font size command}/scale}[\meta{fp expr}]
\KeepNextPar*
-The keys \Key{\meta{font size command}\slash{}scale} set the scale of \meta{font size command} to \meta{fp expr}, ignoring the value set by the key \Key{typographic-scale}.
+The keys \Key{\meta{font size command}\slash{}scale} set the scale of \meta{font size command} to \meta{fp expr}, ignoring the value set by the key \Key{typographic\-/scale}.
The key \Key{normalsize\slash{}scale} is not defined.
\Key{\meta{font size command}/size}[\meta{dim expr}]
\KeepNextPar*
-The keys \Key{\meta{font size command}\slash{}size} set the size of \meta{font size command} to \meta{dim expr}, ignoring the values set by the keys \Key{typographic-scale} and \Key{\meta{font size command}\slash{}scale}.
+The keys \Key{\meta{font size command}\slash{}size} set the size of \meta{font size command} to \meta{dim expr}, ignoring the values set by the keys \Key{typographic\-/scale} and \Key{\meta{font size command}\slash{}scale}.
\meta{dim expr} supplies a default unit of \unit{pt}.
The package will issue a warning if the user sets the keys \Key{\meta{font size command}\slash{}size} and \Key{\meta{font size command}\slash{}scale} for the same \meta{font size command} since the latter key will be ignored.
@@ -196,7 +196,7 @@ The number before/after the slash is the size/leading in \unit{pts}.
\KeepNextPar*
The user should take care to ensure that the font sizes and font baselineskips remain in the correct order when directly setting the scales, sizes, or baselineskips of the different font size commands.
-The magnitudes of the sizes and baselineskips should be ordered from \cs{tiny} to \cs{normalsize} to \cs{Huge}.
+The magnitudes of the font sizes and font baselineskips should be ordered from \cs{tiny} to \cs{normalsize} to \cs{Huge}.
This is important for typographic and syntactic consistency.
This package will issue a warning if they are not in the correct order.
The user can disable this warning via the key \Key{ignore\-/order}[true] or just \Key{ignore\-/order}.
@@ -218,7 +218,7 @@ The user can disable this warning via the key \Key{ignore\-/order}[true] or just
These are fully expandable commands that expand to the current font step, scale, size, or baselineskip.
They can be used for printing or within calculations.
-Caution: \cs{CurrentFontStep} will expand to nothing if the current step is undefined.
+Caution: \cs{CurrentFontStep} will expand to nothing if the current font step is undefined.
Internally, \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} use the kernel command \cs{f@size}.
\cs{CurrentFontSize} expands to \texttt{f@size pt}.
@@ -243,10 +243,10 @@ Generally, users should prefer the font size commands from \cs{tiny} to \cs{Huge
\cs{SetFontStep} sets the font size by setting the font step to \meta{fp expr}.
The starred version \cs{SetFontStep*} adds \meta{fp expr} to the current font step.
If the choice of typographic scale is not modular or musical, then the only valid values for \meta{fp expr} are the integers from \num{-4} to \num{5}, corresponding to the font size commands from \cs{tiny} to \cs{Huge}.
-\cs{SetFontStep} will issue an error if the step is invalid.
-The starred version \cs{SetFontStep*} will also issue an error if the current step is invalid.
+\cs{SetFontStep} will issue an error if the calculated font step is invalid.
+The starred version \cs{SetFontStep*} will also issue an error if the current font step is invalid.
\cs{SetFontStep} sets the font baselineskip to the calculated font size \texttimes{} \Key{baselineskip\-/size\-/ratio}.
-If the step matches the step of any font size command, then that font size command will be used directly.
+If the calculated font step matches the step of any font size command, then that font size command will be used directly.
\listheading{Examples:}
\begin{itemize}
@@ -277,8 +277,8 @@ If the current font size is \cs{normalsize}, \cs{SetFontScale*}\marg{0.2} is equ
\cs{SetFontSize} sets the font size to \meta{dim expr}.
\meta{dim expr} supplies a default unit of \unit{pt}.
-The font baselineskip is set to the font size \texttimes{} \Key{baselineskip\-/size\-/ratio}.
-The starred version \cs{SetFontSize*} adds \meta{dim expr} to the current size.
+The font baselineskip is set to the calculated font size \texttimes{} \Key{baselineskip\-/size\-/ratio}.
+The starred version \cs{SetFontSize*} adds \meta{dim expr} to the current font size.
For example, \cs{SetFontSize*}\marg{1} and \cs{SetFontSize*}\marg{-1pt} increase and decrease the current font size by a \unit{pt}.
\cs{ScaleFont}\marg{\meta{fp expr}}
@@ -291,7 +291,7 @@ For example, if the current font size and font baselineskip are \qty{10}{pt} and
\cs{SetFontSizeBaselineskip}\marg{\meta{dim expr}}\marg{\meta{skip expr}}
\KeepNextPar*
-Sets the font size and font baselineskip to \meta{dim expr} and \meta{skip expr}.
+Sets the font size to \meta{dim expr} and the font baselineskip to \meta{skip expr}.
Both arguments supply a default unit of \unit{pt}.
\cs{SetFontSizeBaselineskip} can be used as an alternative to \cs{fontsize} + \cs{selectfont} as it avoids the issue with \cs{f@size} discussed in \S\ref{subsec:fontparameters}.
@@ -305,8 +305,8 @@ I have used them often when developing this package so I think users will find t
\nopagebreak\newline
\cs{PrintAllFontParameters}
-\cs{PrintFontParameters} prints the current step, scale, size, and baselineskip in this order in a comma\-/separated list of key = value pairs.
-If the current step is undefined (as explained for \cs{SetFontStep} in \S\ref{subsec:fontsize}), it will be left blank.
+\cs{PrintFontParameters} prints the current font step, scale, size, and baselineskip in this order in a comma\-/separated list of key = value pairs.
+If the current font step is undefined (as explained for \cs{SetFontStep} in \S\ref{subsec:fontsize}), it will be left blank.
\cs{PrintAllFontParameters} prints the step, scale, size, and baselineskip of each font size command.
\cs{PrintSampleText}\oarg{\meta{text}}
diff --git a/Master/texmf-dist/tex/latex/fontscale/fontscale.sty b/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
index 514350189c7..7aa22fdd735 100644
--- a/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
+++ b/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
@@ -8,8 +8,8 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage
{fontscale}
- {2024-04-15}
- {1.2.0}
+ {2024-04-21}
+ {1.2.1}
{A user interface for setting document font sizes}
% The 2023-10-10 l3kernel update added many 'e'-variants.
@@ -213,11 +213,7 @@
\msg_line_context: \c_space_tl
are~ not~ in~ the~ correct~ order.~
The~ magnitude~ of~ the~ font~ sizes~ should~ be~ ordered~ from~
- \token_to_str:N \tiny \c_space_tl
- to~
- \token_to_str:N \normalsize \c_space_tl
- to~
- \token_to_str:N \Huge .
+ \iow_char:N \\tiny~ to~ \iow_char:N \\normalsize~ to~ \iow_char:N \\Huge .
}
\msg_new:nnn { fontscale } { font-baselineskips-out-of-order }
{
@@ -225,11 +221,7 @@
\msg_line_context: \c_space_tl
are~ not~ in~ the~ correct~ order.~
The~ magnitude~ of~ the~ font~ baselineskips~ should~ be~ ordered~ from~
- \token_to_str:N \tiny \c_space_tl
- to~
- \token_to_str:N \normalsize \c_space_tl
- to~
- \token_to_str:N \Huge .
+ \iow_char:N \\tiny~ to~ \iow_char:N \\normalsize~ to~ \iow_char:N \\Huge .
}
\msg_new:nnn { fontscale } { font-step-out-of-bounds }
{
@@ -238,6 +230,13 @@
must~ be~ an~ integer~ from~ -4~ to~ 5,~
unless~ the~ choice~ of~ typographic~ scale~ is~ modular~ or~ musical.
}
+\msg_new:nnn { fontscale } { current-font-step-out-of-bounds }
+ {
+ \iow_char:N \\SetFontStep*~
+ \msg_line_context: \c_space_tl
+ could~ not~ calculate~ the~ new~ font~ step~ because~
+ the~ current~ font~ step~ is~ undefined.
+ }
% DEFINE KEYS
@@ -581,11 +580,10 @@
{
\__fontscale_keys_process_normalsize:
\__fontscale_keys_process_other:
- \__fontscale_keys_process_other_props:
+ \__fontscale_keys_process_props:
\__fontscale_keys_process_check_order:
}
-% Sets the size and baselineskip of \normalsize, stores them in a property
-% list, and uses \normalsize.
+% Sets the size and baselineskip of \normalsize and uses \normalsize.
\cs_new_protected:Npn \__fontscale_keys_process_normalsize:
{
\quark_if_no_value:NTF \l__fontscale_normalsize_size_tl
@@ -624,90 +622,71 @@
\l_fontscale_normalsize_baselineskip_skip
{ \l__fontscale_normalsize_baselineskip_tl }
}
- \prop_put:Nno \l_fontscale_normalsize_prop { size }
- { \dim_use:N \l_fontscale_normalsize_size_dim }
- \prop_put:Nno \l_fontscale_normalsize_prop { baselineskip }
- { \skip_use:N \l_fontscale_normalsize_baselineskip_skip }
\normalsize
}
% Sets the size, scale, and baselineskip of the other font size commands.
% Issues a warning if the user sets both the scale and size keys for the same
% font size command.
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xpt:n #1
+\cs_new:Npn \__fontscale_keys_process_other_classic_xpt:n #1
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \str_case:nn {#1}
{
- \str_case:nn {#1}
- {
- { tiny } { 6pt }
- { scriptsize } { 7pt }
- { footnotesize } { 8pt }
- { small } { 9pt }
- { large } { 11pt }
- { Large } { 12pt }
- { LARGE } { 14pt }
- { huge } { 16pt }
- { Huge } { 18pt }
- }
+ { tiny } { 6pt }
+ { scriptsize } { 7pt }
+ { footnotesize } { 8pt }
+ { small } { 9pt }
+ { large } { 11pt }
+ { Large } { 12pt }
+ { LARGE } { 14pt }
+ { huge } { 16pt }
+ { Huge } { 18pt }
}
}
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xipt:n #1
+\cs_new:Npn \__fontscale_keys_process_other_classic_xipt:n #1
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \str_case:nn {#1}
{
- \str_case:nn {#1}
- {
- { tiny } { 7pt }
- { scriptsize } { 8pt }
- { footnotesize } { 9pt }
- { small } { 10pt }
- { large } { 12pt }
- { Large } { 14pt }
- { LARGE } { 16pt }
- { huge } { 18pt }
- { Huge } { 21pt }
- }
+ { tiny } { 7pt }
+ { scriptsize } { 8pt }
+ { footnotesize } { 9pt }
+ { small } { 10pt }
+ { large } { 12pt }
+ { Large } { 14pt }
+ { LARGE } { 16pt }
+ { huge } { 18pt }
+ { Huge } { 21pt }
}
}
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xiipt:n #1
+\cs_new:Npn \__fontscale_keys_process_other_classic_xiipt:n #1
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \str_case:nn {#1}
{
- \str_case:nn {#1}
- {
- { tiny } { 8pt }
- { scriptsize } { 9pt }
- { footnotesize } { 10pt }
- { small } { 11pt }
- { large } { 14pt }
- { Large } { 16pt }
- { LARGE } { 18pt }
- { huge } { 21pt }
- { Huge } { 24pt }
- }
+ { tiny } { 8pt }
+ { scriptsize } { 9pt }
+ { footnotesize } { 10pt }
+ { small } { 11pt }
+ { large } { 14pt }
+ { Large } { 16pt }
+ { LARGE } { 18pt }
+ { huge } { 21pt }
+ { Huge } { 24pt }
}
}
-\cs_new_protected:Npn \__fontscale_keys_process_other_modular:n #1
+\cs_new:Npn \__fontscale_keys_process_other_modular:n #1
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \fp_to_dim:n
{
- \fp_to_dim:n
- {
- \l__fontscale_normalsize_size_fp * \l__fontscale_modular_ratio_fp
- ^ \use:c { c_fontscale_#1_step_fp }
- }
+ \l__fontscale_normalsize_size_fp * \l__fontscale_modular_ratio_fp
+ ^ \use:c { c_fontscale_#1_step_fp }
}
}
-\cs_new_protected:Npn \__fontscale_keys_process_other_musical:n #1
+\cs_new:Npn \__fontscale_keys_process_other_musical:n #1
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \fp_to_dim:n
{
- \fp_to_dim:n
- {
- \l__fontscale_normalsize_size_fp * \l__fontscale_musical_ratio_fp
- ^ ( \use:c { c_fontscale_#1_step_fp }
- / \l__fontscale_musical_notes_fp )
- }
+ \l__fontscale_normalsize_size_fp * \l__fontscale_musical_ratio_fp
+ ^ ( \use:c { c_fontscale_#1_step_fp }
+ / \l__fontscale_musical_notes_fp )
}
}
\cs_new_protected:Npn \__fontscale_keys_process_other:
@@ -767,7 +746,9 @@
}
\prg_break:
}
- \prg_break:n { \__fontscale_keys_process_other_typographic_scale:n {#1} }
+ \dim_set:cn { l_fontscale_#1_size_dim }
+ { \__fontscale_keys_process_other_typographic_scale:n {#1} }
+ \prg_break:
\prg_break_point:
\fp_set:cn { l_fontscale_#1_scale_fp }
{ \use:c { l_fontscale_#1_size_dim } / \l__fontscale_normalsize_size_fp }
@@ -788,9 +769,9 @@
{ \use:c { l__fontscale_#1_baselineskip_tl } }
}
}
-% Puts the scale, size, and baselineskip of the other font size commands in
-% property lists.
-\cs_new_protected:Npn \__fontscale_keys_process_other_props:
+% Puts the scale, size, and baselineskip of each font size command in
+% property lists, except the scale of \normalsize.
+\cs_new_protected:Npn \__fontscale_keys_process_props:
{
\prop_put:Nne \l_fontscale_tiny_prop { scale }
{ \fp_use:N \l_fontscale_tiny_scale_fp }
@@ -819,6 +800,8 @@
{ \dim_use:N \l_fontscale_footnotesize_size_dim }
\prop_put:Nno \l_fontscale_small_prop { size }
{ \dim_use:N \l_fontscale_small_size_dim }
+ \prop_put:Nno \l_fontscale_normalsize_prop { size }
+ { \dim_use:N \l_fontscale_normalsize_size_dim }
\prop_put:Nno \l_fontscale_large_prop { size }
{ \dim_use:N \l_fontscale_large_size_dim }
\prop_put:Nno \l_fontscale_Large_prop { size }
@@ -838,6 +821,8 @@
{ \skip_use:N \l_fontscale_footnotesize_baselineskip_skip }
\prop_put:Nno \l_fontscale_small_prop { baselineskip }
{ \skip_use:N \l_fontscale_small_baselineskip_skip }
+ \prop_put:Nno \l_fontscale_normalsize_prop { baselineskip }
+ { \skip_use:N \l_fontscale_normalsize_baselineskip_skip }
\prop_put:Nno \l_fontscale_large_prop { baselineskip }
{ \skip_use:N \l_fontscale_large_baselineskip_skip }
\prop_put:Nno \l_fontscale_Large_prop { baselineskip }
@@ -1075,7 +1060,7 @@
{
\tl_set:Ne \l__fontscale_step_tl { \__fontscale_current_font_step: }
\tl_if_empty:NTF \l__fontscale_step_tl
- { \msg_error:nn { fontscale } { font-step-out-of-bounds } }
+ { \msg_error:nn { fontscale } { current-font-step-out-of-bounds } }
{ \__fontscale_add_font_step_aux:n { (#1) + \l__fontscale_step_tl } }
}
\cs_new_eq:NN \__fontscale_add_font_step_aux:n \__fontscale_set_font_step:n