texlive[74859] Master/texmf-dist: fontscale (5apr25)
commits+karl at tug.org
commits+karl at tug.org
Sat Apr 5 21:55:27 CEST 2025
Revision: 74859
https://tug.org/svn/texlive?view=revision&revision=74859
Author: karl
Date: 2025-04-05 21:55:27 +0200 (Sat, 05 Apr 2025)
Log Message:
-----------
fontscale (5apr25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.pdf
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex
trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md 2025-04-05 19:55:27 UTC (rev 74859)
@@ -7,6 +7,52 @@
## [Unreleased]
+## [v4.1.0] - 2025-04-04
+
+### Added
+- New keys:
+ - `typographic-scale/classic-10bp`
+ - `typographic-scale/classic-11bp`
+ - `typographic-scale/classic-12bp`
+ - `typographic-scale/classic-10dd`
+ - `typographic-scale/classic-11dd`
+ - `typographic-scale/classic-12dd`
+ - `typographic-scale/classic-10nd`
+ - `typographic-scale/classic-11nd`
+ - `typographic-scale/classic-12nd`
+ - `classic-10bp`
+ - `classic-11bp`
+ - `classic-12bp`
+ - `classic-10dd`
+ - `classic-11dd`
+ - `classic-12dd`
+ - `classic-10nd`
+ - `classic-11nd`
+ - `classic-12nd`
+ - `<font size command>/baselineskip-size-ratio`
+- `\currentnormalsize`
+
+### Changed
+- Improved performance in the package code added to the `selectfont` hook.
+- The documentation now states that `fontscale` does not load any other
+ packages.
+- The documentation now states that `\currentfontstep`, `\currentfontscale`,
+ and `\currentfontsize` do not expand `\f at size`.
+
+### Fixed
+- The documentation now correctly states that the classic typographic scale
+ includes font size `30`. (`30` was not included in some older versions of The
+ Elements of Typographic Style by Robert Bringhurst.)
+- The package now correctly uses `\dim_use:N` and `\skip_use:N` when using
+ `expl3` `dim` and `skip` variables in `LaTeX2e` commands.
+- Removed incorrect code comment regarding compatibility with the `microtype`
+ package.
+- The internal commands that store the value of the keys
+ `<font size command>/scale`, `<font size command>/size`, and
+ `<font size command>/baselineskip` now correctly store the value of the
+ evaluated floating point/dimen/skip expression. This should result in more
+ consistent behavior if `\fontscalesetup` is used again.
+
## [v4.0.1] - 2025-03-11
### Changed
@@ -153,13 +199,6 @@
- `\CurrentFontSizeCommand` (redundant with `\CurrentFontSize` and
`\CurrentFontBaselineskip`)
-### Fixed
-- The error message for `\SetFontStep*` when the current font step is undefined
- no longer writes `\SetFontStep*`. This would be incorrect if its
- corresponding internal function was used instead of `\SetFontStep*`.
-- The internal functions of `\PrintSampleText` now correctly enclose their
- contents within a group.
-
## [v2.4.0] - 2024-09-10
### Changed
@@ -208,7 +247,7 @@
- `\fontscalesetup` is now removed in `\text_purify:n`.
### Removed
-- Keys `typographic-scale=modular` and `modular`.
+- Keys `typographic-scale/modular` and `modular`.
- Key `ignore-order` (no support for using `\tiny` to `\Huge` in the wrong
order).
- Key `reset` (very rarely used).
@@ -256,7 +295,7 @@
### Fixed
- The documentation no longer incorrectly compares `\ScaleFont` with
`\scalefont` from the `scalefnt` package.
-- The internal function for the key `reset=preamble` now correctly initializes
+- The internal function for the key `reset/preamble` now correctly initializes
to `\prg_do_nothing:`.
## [v1.2.1] - 2024-04-21
@@ -278,7 +317,7 @@
- Documentation improvements.
### Fixed
-- The key `reset=preamble` and `\SetFontStep` no longer rely on undocumented
+- The key `reset/preamble` and `\SetFontStep` no longer rely on undocumented
`expl3` features.
- Corrected typo in the documentation.
@@ -306,8 +345,8 @@
- Performance and code improvements.
### Fixed
-- Fixed issue where the key `reset=preamble` relied on an unsupported `V`-type
- `bool` argument.
+- The key `reset/preamble` no longer relies on an unsupported `V`-type `bool`
+ argument.
## [v1.0.1] - 2024-03-08
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls 2025-04-05 19:55:27 UTC (rev 74859)
@@ -3,7 +3,7 @@
% LOADING THE CLASS
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
-\ProvidesExplClass{beery}{2025-03-11}{0.0.0}{}
+\ProvidesExplClass{beery}{2025-04-04}{0.0.0}{}
\prop_gput:Nnn \g_msg_module_type_prop { beery } { Class }
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex 2025-04-05 19:55:27 UTC (rev 74859)
@@ -20,7 +20,7 @@
Oliver Beery
-Version 4.0.1\quad{}11 March 2025
+Version 4.1.0\quad{}4 April 2025
\dochighinput[language=latex/latex3]{fontscale.sty}
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex 2025-04-05 19:55:27 UTC (rev 74859)
@@ -1,10 +1,10 @@
-\ProvidesFile{fontscale-table-classic.tex}[2025-03-11]
+\ProvidesFile{fontscale-table-classic.tex}[2025-04-04]
\begin{table}
\centering
\caption
{%
- The font size of each font size command from \cs{tiny} to \cs{Huge} in units of \unit{pt} when using a classic typographic scale.%
+ The font size of each font size command from \cs{tiny} to \cs{Huge} in units of \unit{pt}, \unit{bp}, \unit{dd}, or \unit{nd} when using a classic typographic scale.%
\label{table:classic}%
}
\bigskip
@@ -19,10 +19,12 @@
}
, cell{1}{2-Z}={guard}
, cell{2-Z}{1}={cmd=\cs}
- , cell{1}{2-Z}={cmd=\key}
}
\toprule
- font size command & classic-10pt & classic-11pt & classic-12pt \\
+ font size command
+ & {\key{classic-10pt} \\ \key{classic-10bp} \\ \key{classic-10dd} \\ \key{classic-10nd}}
+ & {\key{classic-11pt} \\ \key{classic-11bp} \\ \key{classic-11dd} \\ \key{classic-11nd}}
+ & {\key{classic-12pt} \\ \key{classic-12bp} \\ \key{classic-12dd} \\ \key{classic-12nd}} \\
\midrule
tiny & 6 & 7 & 8 \\
scriptsize & 7 & 8 & 9 \\
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex 2025-04-05 19:55:27 UTC (rev 74859)
@@ -1,4 +1,4 @@
-\ProvidesFile{fontscale-table-font-steps.tex}[2025-03-11]
+\ProvidesFile{fontscale-table-font-steps.tex}[2025-04-04]
\begin{table}
\centering
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex 2025-04-05 19:55:27 UTC (rev 74859)
@@ -1,4 +1,4 @@
-\ProvidesFile{fontscale-table-musical.tex}[2025-03-11]
+\ProvidesFile{fontscale-table-musical.tex}[2025-04-04]
\begin{table}
\centering
@@ -22,10 +22,10 @@
\toprule
font size command & \key{musical} \\
\midrule
- tiny & 5.74 \\
- scriptsize & 6.60 \\
- footnotesize & 7.58 \\
- small & 8.71 \\
+ tiny & 5.74 \\
+ scriptsize & 6.60 \\
+ footnotesize & 7.58 \\
+ small & 8.71 \\
normalsize & 10 \\
large & 11.49 \\
Large & 13.20 \\
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex 2025-04-05 19:55:27 UTC (rev 74859)
@@ -4,17 +4,13 @@
\begin{document}
-\section*
- {%
- \setfontstep*{1}%
- The \pkg{fontscale} package%
- }
+\section*{\setfontstep*{1}The \pkg{fontscale} package}
A flexible interface for setting font sizes
Oliver Beery
-Version 4.0.1\quad{}11 March 2025
+Version 4.1.0\quad{}4 April 2025
\section{Introduction}
@@ -32,7 +28,7 @@
\item
Set the font sizes and font baselineskips of the standard \LaTeX{} font size commands mid-document or within a local group (\S\ref{subsec:fontscalesetup}).
\item
- Provides expandable commands that expand to the current font step, font scale, font size, or font baselineskip (\S\ref{subsec:expandable}).
+ Provides expandable commands that expand to the current font size of \cs{normalsize} and the current font step, font scale, font size, or font baselineskip (\S\ref{subsec:expandable}).
\item
Provides additional font size commands, including setting the font size by setting the font step or font scale and setting the font size relative to the current font size using more robust tools than the \pkg{scalefnt} and \pkg{relsize} packages (\S\ref{subsec:fontsize}).
\item
@@ -57,6 +53,8 @@
You may need to ensure that your \LaTeX{} installation is up-to-date before using this package.
+\pkg{fontscale} does not load any other packages.
+
This package lets the user set arbitrary font sizes.
This works with most fonts produced today, but, for historical reasons, the default Computer Modern font is available only in a number of discrete font sizes.
If you get a warning that Computer Modern is not available in the requested font size, you may need to add the code \cs{RequirePackage}\allowbreak|{fix-cm}| before \cs{documentclass} to make Computer Modern available at arbitrary font sizes.
@@ -122,29 +120,19 @@
\displaykey{typographic-scale}[\meta{choice}][classic-10pt]
\end{displaycode}
-\meta{choice} must be \keyvalue{classic-10pt}, \keyvalue{classic-11pt}, \keyvalue{classic-12pt}, or \keyvalue{musical}.
-The initial value is \keyvalue{classic-10pt}.
+\meta{choice} must be \keyvalue{classic-10pt}, \keyvalue{classic-11pt}, \keyvalue{classic-12pt}, \keyvalue{classic-10bp}, \keyvalue{classic-11bp}, \keyvalue{classic-12bp}, \keyvalue{classic-10dd}, \keyvalue{classic-11dd}, \keyvalue{classic-12dd}, \keyvalue{classic-10nd}, \keyvalue{classic-11nd}, \keyvalue{classic-12nd}, or \keyvalue{musical}.
+
Sets the font size of each font size command from \cs{tiny} to \cs{Huge} using a classic or musical typographic scale.
These are common methods of choosing a set of document font sizes.
+The initial value is \keyvalue{classic-10pt}.
+As a shortcut, each \meta{choice} is also available as a standalone key.
+For example, the key \key{classic-10pt} is equivalent to the key \key{typographic-scale=classic-10pt} and the key \key{musical} is equivalent to the key \key{typographic-scale=musical}.
-\begin{displaycode}
- \displaykey{classic-10pt}
- \nopagebreak\newline
- \displaykey{classic-11pt}
- \newline
- \displaykey{classic-12pt}
- \nopagebreak\newline
- \displaykey{musical}
-\end{displaycode}
-
-These keys are shortcuts that set the key \key{typographic-scale} to the corresponding value.
-
-The classic typographic scale consists of the traditional font sizes
-\numlist{6;7;8;9;10;11;12;14;16;18;21;24;36;48;60;72}.%
-\footnote{See \S3.1 of \textit{The Elements of Typographic Style} by Robert Bringhurst.}
+The classic typographic scale consists of the traditional font sizes in points:
+\numlist{6;7;8;9;10;11;12;14;16;18;21;24;30;36;48;60;72}.%
+\footnote{See \textit{The Elements of Typographic Style} by Robert Bringhurst.}
They have been used since the sixteenth century and are the default font sizes on most computer software.
-Setting the value of the key \key{typographic-scale} to \keyvalue{classic-10pt}, \keyvalue{classic-11pt}, or \keyvalue{classic-12pt} sets the font size of each font size command from \cs{tiny} to \cs{Huge} to values based on their position in the classic typographic scale.
-The named point size---\qty{10}{pt}, \qty{11}{pt}, or \qty{12}{pt}---is the font size of \cs{normalsize}.
+The named point size is the font size of \cs{normalsize}.
The font sizes of the other font size commands are the adjacent font sizes in the classic typographic scale.
Table \ref{table:classic} displays the font size of each font size command when using a classic typographic scale.
@@ -158,8 +146,7 @@
\displaykey{musical/notes}[\meta{integer expression}][5]
\end{displaycode}
-The key \key{typographic-scale=musical} sets the font size of each font size command from \cs{tiny} to \cs{Huge} using a musical typographic scale.
-The font sizes are calculated using the formula:%
+When using a musical typographic scale, the font sizes are calculated using the formula:%
\footnote
{
I have referenced this article by Spencer Mortensen:
@@ -201,14 +188,14 @@
\subsection{Overwriting the previous keys}
\label{subsec:overwriting}
-This subsection documents keys for directly setting the font sizes and font baselineskips of the font size commands from \cs{tiny} to \cs{Huge}.
-The font sizes can also be set by setting the font scale.
+This subsection documents keys for setting the font sizes and font baselineskips of the font size commands from \cs{tiny} to \cs{Huge} in a more direct manner.
The user should take care to ensure that the lengths of the font sizes remain correctly ordered from \cs{tiny} to \cs{Huge}.
This is important for typographic and syntactic consistency.
If the font sizes are in the wrong order, \cs{fontscalesetup} will issue a warning and some package features may not work correctly.
-The syntax \meta{font size command} represents the name of a font size command from \cs{tiny} to \cs{Huge}, omitting the backslash character.
+The syntax \meta{font size command} represents the name of a font size command from \cs{tiny} to \cs{Huge}, omitting the backslash |\|.
+\pagebreak%manual
\begin{displaycode}
\displaykey{\meta{font size command}/scale}[\meta{floating point expression}][\meta{not set}]
@@ -228,18 +215,29 @@
These keys are initially not set.
\begin{displaycode}
- \displaykey{\meta{font size command}/baselineskip}[\meta{skip expression}][\meta{not set}]
+ \displaykey{\meta{font size command}}[\meta{dimen expression}]
\end{displaycode}
-Sets the font baselineskip of \meta{font size command} to the value of \meta{skip expression}.
+Sets the key \key{\meta{font size command}/size=\meta{dimen expression}}.
+
+\begin{displaycode}
+ \displaykey{\meta{font size command}/baselineskip-size-ratio}
+ [\meta{floating point expression}]%
+ \newline
+ \hspace*{\fill}\texttt{initial$\,=\,$\meta{not set}}
+\end{displaycode}
+
+Sets the font baselineskip of \meta{font size command} equal to its font size \texttimes{} the result of computing \meta{floating point expression}.
Overwrites the font baselineskip set by the key \key{baselineskip-size-ratio}.
These keys are initially not set.
\begin{displaycode}
- \displaykey{\meta{font size command}}[\meta{dimen expression}]
+ \displaykey{\meta{font size command}/baselineskip}[\meta{skip expression}][\meta{not set}]
\end{displaycode}
-Sets the key \key{\meta{font size command}/size=\meta{dimen expression}}.
+Sets the font baselineskip of \meta{font size command} to the value of \meta{skip expression}.
+Overwrites the font baselineskip set by the keys \key{baselineskip-size-ratio} and \key{\meta{font size command}/baselineskip-size-ratio}.
+These keys are initially not set.
\section{Commands}
@@ -261,10 +259,16 @@
Does nothing, except issue a warning, if used in math mode.
\cs{fontscalesetup} should typically be used only once in the preamble or omitted if the user is satisfied with the initial font sizes and font baselineskips.
-\subsection{Expandable font size parameters}
+\subsection{Expandable commands}
\label{subsec:expandable}
\begin{displaycode}
+ \cs{currentnormalsize}
+\end{displaycode}
+
+Expands to the current font size of \cs{normalsize}.
+
+\begin{displaycode}
\cs{currentfontstep}
\nopagebreak\newline
\cs{currentfontscale}
@@ -274,7 +278,8 @@
\cs{currentfontbaselineskip}
\end{displaycode}
-This package provides expandable commands that expand to the current font step, font scale, font size, or font baselineskip.
+Expands to the current font step, font scale, font size, or font baselineskip.
+\cs{currentfontstep}, \cs{currentfontscale}, and \cs{currentfontsize} do not expand the kernel command \cs{f at size}.
They can be used for printing or within calculations.
For clarity, \cs{currentfontstep} will be explained in detail.
@@ -299,17 +304,11 @@
\listheading{Three exceptions:}
\begin{itemize}
\item
- If the font step equals the font step of any font size command from \cs{tiny} to \cs{Huge} (Table \ref{table:fontsteps}), then that font size command will be used directly.%
- \footnote
- {
- \label{fn:setfontstep}%
- The font step is rounded to \num{5} decimal places when testing equality due to floating point precision.
- }
+ If the font step, rounded to \num{5} decimal places, equals the font step of any font size command from \cs{tiny} to \cs{Huge} (Table \ref{table:fontsteps}), then that font size command will be used directly.
\item
\cs{setfontstep} will issue an error if the font step is undefined (as explained for \cs{currentfontstep} in \S\ref{subsec:expandable}).
- The font step must equal the font step of any font size command from \cs{tiny} to \cs{Huge} unless the value of the key \key{typographic-scale} is \keyvalue{musical}.%
- \footnote{See Footnote \ref{fn:setfontstep}.}
- \cs{setfontstep*} will always issue an error if the current font step is undefined.
+ The font step, rounded to \num{5} decimal places, must equal the font step of any font size command from \cs{tiny} to \cs{Huge} unless the value of the key \key{typographic-scale} is \keyvalue{musical}.
+ When adding the optional star \sarg, the current font step must be defined.
\item
Does nothing, except issue a warning, if used in math mode.
\end{itemize}
@@ -377,6 +376,7 @@
The printed font step and font scale are rounded to \num{5} decimal places.
To print with more decimal places, use \cs{currentfontstep} and \cs{currentfontscale} (\S\ref{subsec:expandable}).
The printed font step will be left blank if it is undefined (as explained for \cs{currentfontstep} in \S\ref{subsec:expandable}).
+\pagebreak%manual
\begin{displaycode}
\cs{printallfontsizeparameters}
@@ -430,7 +430,7 @@
This package defines some public \pkg{expl3} variables.
They are set either by \cs{fontscalesetup} or in the \hook{selectfont} hook.
They should never be modified directly.
-The syntax \meta{font size command} represents the name of a font size command from \cs{tiny} to \cs{Huge}, omitting the backslash character.
+The syntax \meta{font size command} represents the name of a font size command from \cs{tiny} to \cs{Huge}, omitting the backslash |\|.
\begin{displaycode}
\cs{c_fontscale_\meta{font size command}_step_fp}
Modified: trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2025-04-05 19:55:12 UTC (rev 74858)
+++ trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2025-04-05 19:55:27 UTC (rev 74859)
@@ -9,8 +9,8 @@
% LaTeX2e version 2023-11-01 added \IfExplAtLeastTF.
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\DeclareRelease{v3}{2025-02-13}{fontscale-v3.sty}
-\DeclareCurrentRelease{}{2025-03-11}
-\ProvidesExplPackage{fontscale}{2025-03-11}{4.0.1}
+\DeclareCurrentRelease{}{2025-04-04}
+\ProvidesExplPackage{fontscale}{2025-04-04}{4.1.0}
{A flexible interface for setting font sizes}
% l3kernel version 2023-11-09 added documentation for \c_nan_fp.
@@ -67,6 +67,12 @@
The~ font~ size~ set~ by~ the~ key~ '#1 / scale'~
has~ been~ overwritten~ by~ the~ key~ '#1 / size'~ \msg_line_context:.
}
+\msg_new:nnn { fontscale } { key-name-baselineskip-size-ratio-overwritten }
+ {
+ The~ font~ baselineskip~ set~ by~ the~ key~ '#1 / baselineskip-size-ratio'~
+ has~ been~ overwritten~ by~ the~ key~ '#1 / baselineskip'~
+ \msg_line_context:.
+ }
\msg_new:nnn { fontscale } { font-sizes-wrong-order }
{
The~ font~ sizes~ are~ not~ in~ the~ correct~ order~ \msg_line_context:. \\
@@ -190,75 +196,77 @@
\dim_new:N \l_fontscale_size_dim
\skip_new:N \l_fontscale_baselineskip_skip
-% For speed, \__fontscale_hook_selectfont: tries to avoid computing a floating
-% point expression by using \fp_set_eq:NN when the font size equals the font
-% size of any font size command from \tiny to \Huge. The case when the font
-% size equals that of \normalsize is optimized further because it is by far
-% the most common case. \f at size and \f at baselineskip are not used elsewhere in
-% this package.
+% Some optimizations for \__fontscale_hook_selectfont:
+% (1) Tries to avoid computing a floating point expression by using
+% \fp_set_eq:NN when the font size equals the font size of any font size
+% command from \tiny to \Huge.
+% (2) Prefers \if_dim:w to \dim_compare:nNnTF or \dim_case:nnTF.
+% (3) Tests the font sizes roughly in order of usage rate.
+% (4) The case when the font size equals that of \normalsize is optimized
+% further because it is by far the most common case.
+% \f at size and \f at baselineskip are not used elsewhere in this package.
\cs_new_protected:Npn \__fontscale_hook_selectfont:
{
\dim_set:Nn \l_fontscale_size_dim { \f at size pt }
\skip_set:Nn \l_fontscale_baselineskip_skip { \f at baselineskip }
- \dim_compare:nNnTF \l_fontscale_size_dim = \l_fontscale_normalsize_size_dim
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_normalsize_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \c_fontscale_normalsize_scale_fp
- }
- { \__fontscale_hook_selectfont_auxi: }
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_normalsize_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_normalsize:
+ \else:
+ \exp_after:wN \__fontscale_hook_selectfont_auxi:
+ \fi:
}
+\cs_new_protected:Npn \__fontscale_hook_selectfont_normalsize:
+ {
+ \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_normalsize_step_fp
+ \fp_set_eq:NN \l_fontscale_scale_fp \c_fontscale_normalsize_scale_fp
+ }
\cs_new_protected:Npn \__fontscale_hook_selectfont_auxi:
{
- \dim_case:nnF { \l_fontscale_size_dim }
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_small_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_small:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_large_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_large:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_footnotesize_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_footnotesize:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_Large_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_Large:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_scriptsize_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_scriptsize:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_LARGE_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_LARGE:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_tiny_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_tiny:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_huge_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_huge:
+ \fi:
+ \if_dim:w \l_fontscale_size_dim = \l_fontscale_Huge_size_dim
+ \exp_after:wN \__fontscale_hook_selectfont_Huge:
+ \fi:
+ \__fontscale_hook_selectfont_auxii:
+ \prg_break:
+ \prg_break_point:
+ }
+\tl_map_inline:nn
+ {
+ {tiny} {scriptsize} {footnotesize} {small}
+ {large} {Large} {LARGE} {huge} {Huge}
+ }
+ {
+ \cs_new_protected:cpe { __fontscale_hook_selectfont_#1: }
{
- { \l_fontscale_small_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_small_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_small_scale_fp
- }
- { \l_fontscale_large_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_large_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_large_scale_fp
- }
- { \l_fontscale_footnotesize_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_footnotesize_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp
- \l_fontscale_footnotesize_scale_fp
- }
- { \l_fontscale_Large_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_Large_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_Large_scale_fp
- }
- { \l_fontscale_scriptsize_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_scriptsize_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_scriptsize_scale_fp
- }
- { \l_fontscale_LARGE_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_LARGE_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_LARGE_scale_fp
- }
- { \l_fontscale_tiny_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_tiny_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_tiny_scale_fp
- }
- { \l_fontscale_huge_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_huge_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_huge_scale_fp
- }
- { \l_fontscale_Huge_size_dim }
- {
- \fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_Huge_step_fp
- \fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_Huge_scale_fp
- }
+ \fp_set_eq:NN \exp_not:N \l_fontscale_step_fp
+ \exp_not:c { c_fontscale_#1_step_fp }
+ \fp_set_eq:NN \exp_not:N \l_fontscale_scale_fp
+ \exp_not:c { l_fontscale_#1_scale_fp }
+ \exp_not:N \prg_break:
}
- { \__fontscale_hook_selectfont_auxii: }
}
\cs_new_protected:Npn \__fontscale_hook_selectfont_auxii:
{
@@ -295,11 +303,11 @@
\fp_new:N \l__fontscale_musical_base_fp
\fp_new:N \l__fontscale_musical_notes_fp
\fp_new:N \l__fontscale_musical_selectfont_fp
-
\fp_const:Nn \c__fontscale_five_fp { 5 }
-% Scratch variable
-\fp_new:N \l__fontscale_tmp_fp
+% Scratch variables
+\clist_new:N \l__fontscale_tmp_clist
+\fp_new:N \l__fontscale_tmp_fp
%%> \section{Some functions}
@@ -310,7 +318,7 @@
% unit of 'pt'.
% (2) Avoids the issue where \f at size is set to the new font size before the
% second argument is expanded.
-% (3) Issues a user-friendly error message if the font size is not positive.
+% (3) Issues a user-friendly error message if the font size is invalid.
\cs_new_protected:Npn \__fontscale_set_font_size:nn #1#2
{
\use:e
@@ -347,31 +355,28 @@
%%> \section{Define keys}
+\clist_set:Nn \l__fontscale_tmp_clist
+ {
+ classic-10pt , classic-11pt , classic-12pt
+ , classic-10bp , classic-11bp , classic-12bp
+ , classic-10dd , classic-11dd , classic-12dd
+ , classic-10nd , classic-11nd , classic-12nd , musical
+ }
\str_new:N \l__fontscale_typographic_scale_str
-
\keys_define:nn { fontscale }
{
- baselineskip-size-ratio .fp_set:N =
- \l__fontscale_baselineskip_size_ratio_fp
- , baselineskip-size-ratio .value_required:n = true
-
- , typographic-scale .choices:nn =
- { classic-10pt , classic-11pt , classic-12pt , musical }
+ typographic-scale .choices:Vn = \l__fontscale_tmp_clist
{ \str_set:Nn \l__fontscale_typographic_scale_str {#1} }
, typographic-scale .value_required:n = true
-
- , classic-10pt .meta:n = { typographic-scale = classic-10pt }
- , classic-10pt .value_forbidden:n = true
-
- , classic-11pt .meta:n = { typographic-scale = classic-11pt }
- , classic-11pt .value_forbidden:n = true
-
- , classic-12pt .meta:n = { typographic-scale = classic-12pt }
- , classic-12pt .value_forbidden:n = true
-
- , musical .meta:n = { typographic-scale = musical }
- , musical .value_forbidden:n = true
}
+\clist_map_inline:Nn \l__fontscale_tmp_clist
+ {
+ \keys_define:nn { fontscale }
+ {
+ #1 .meta:n = { typographic-scale = #1 }
+ , #1 .value_forbidden:n = true
+ }
+ }
\keys_define:nn { fontscale / musical }
{
base .dim_set:N = \l__fontscale_musical_base_dim
@@ -383,17 +388,15 @@
, notes .int_set:N = \l__fontscale_musical_notes_int
, notes .value_required:n = true
}
-\keys_define:nn { fontscale / normalsize }
+\keys_define:nn { fontscale }
{
- size .tl_set:N = \l__fontscale_normalsize_size_tl
- , size .value_required:n = true
-
- , baselineskip .tl_set:N = \l__fontscale_normalsize_baselineskip_tl
- , baselineskip .value_required:n = true
+ baselineskip-size-ratio .fp_set:N =
+ \l__fontscale_baselineskip_size_ratio_fp
+ , baselineskip-size-ratio .value_required:n = true
}
\tl_map_inline:nn
{
- {tiny} {scriptsize} {footnotesize} {small}
+ {tiny} {scriptsize} {footnotesize} {small} {normalsize}
{large} {Large} {LARGE} {huge} {Huge}
}
{
@@ -407,41 +410,19 @@
, baselineskip .tl_set:c = { l__fontscale_#1_baselineskip_tl }
, baselineskip .value_required:n = true
+
+ , baselineskip-size-ratio .tl_set:c =
+ { l__fontscale_#1_baselineskip_size_ratio_tl }
+ , baselineskip-size-ratio .value_required:n = true
}
+ \keys_define:nn { fontscale }
+ {
+ #1 .tl_set:c = { l__fontscale_#1_size_tl }
+ , #1 .value_required:n = true
+ }
}
-\keys_define:nn { fontscale }
- {
- tiny .tl_set:N = \l__fontscale_tiny_size_tl
- , tiny .value_required:n = true
+\keys_define:nn { fontscale / normalsize } { scale .undefine: }
- , scriptsize .tl_set:N = \l__fontscale_scriptsize_size_tl
- , scriptsize .value_required:n = true
-
- , footnotesize .tl_set:N = \l__fontscale_footnotesize_size_tl
- , footnotesize .value_required:n = true
-
- , small .tl_set:N = \l__fontscale_small_size_tl
- , small .value_required:n = true
-
- , normalsize .tl_set:N = \l__fontscale_normalsize_size_tl
- , normalsize .value_required:n = true
-
- , large .tl_set:N = \l__fontscale_large_size_tl
- , large .value_required:n = true
-
- , Large .tl_set:N = \l__fontscale_Large_size_tl
- , Large .value_required:n = true
-
- , LARGE .tl_set:N = \l__fontscale_LARGE_size_tl
- , LARGE .value_required:n = true
-
- , huge .tl_set:N = \l__fontscale_huge_size_tl
- , huge .value_required:n = true
-
- , Huge .tl_set:N = \l__fontscale_Huge_size_tl
- , Huge .value_required:n = true
- }
-
%%> \section{Initialize and pre-compile keys}
% Pre-compiles the keys with their initial values and then sets the keys to
@@ -450,11 +431,11 @@
% corresponding key has been set by the user.
\cs_new_protected:Npn \__fontscale_keys_set_initial:
{
- \fp_set:Nn \l__fontscale_baselineskip_size_ratio_fp { 1.2 }
\str_set:Nn \l__fontscale_typographic_scale_str { classic-10pt }
\dim_set:Nn \l__fontscale_musical_base_dim { 10pt }
\fp_set:Nn \l__fontscale_musical_ratio_fp { 2 }
\int_set:Nn \l__fontscale_musical_notes_int { 5 }
+ \fp_set:Nn \l__fontscale_baselineskip_size_ratio_fp { 1.2 }
\tl_map_inline:nn
{
@@ -489,6 +470,17 @@
\l__fontscale_LARGE_baselineskip_tl
\l__fontscale_huge_baselineskip_tl
\l__fontscale_Huge_baselineskip_tl
+
+ \l__fontscale_tiny_baselineskip_size_ratio_tl
+ \l__fontscale_scriptsize_baselineskip_size_ratio_tl
+ \l__fontscale_footnotesize_baselineskip_size_ratio_tl
+ \l__fontscale_small_baselineskip_size_ratio_tl
+ \l__fontscale_normalsize_baselineskip_size_ratio_tl
+ \l__fontscale_large_baselineskip_size_ratio_tl
+ \l__fontscale_Large_baselineskip_size_ratio_tl
+ \l__fontscale_LARGE_baselineskip_size_ratio_tl
+ \l__fontscale_huge_baselineskip_size_ratio_tl
+ \l__fontscale_Huge_baselineskip_size_ratio_tl
}
{ \tl_set:Nn ##1 { \q_no_value } }
}
@@ -522,9 +514,8 @@
\cs_new_protected:Npn \__fontscale_keys_process:
{
\__fontscale_keys_process_start:
- \__fontscale_keys_process_normalsize:
- \__fontscale_keys_process_other:
- \__fontscale_keys_process_check_order:
+ \__fontscale_keys_process_sizes:
+ \__fontscale_keys_process_baselineskips:
}
\cs_new_protected:Npn \__fontscale_keys_process_start:
{
@@ -546,21 +537,30 @@
\l__fontscale_musical_notes_int
\prg_break:
}
+ \str_if_eq:VnT \l__fontscale_typographic_scale_str { musical }
+ {
+ \fp_set:Nn \l__fontscale_musical_base_fp
+ { \dim_to_fp:n { \l__fontscale_musical_base_dim } }
+ \fp_set:Nn \l__fontscale_musical_notes_fp
+ { \int_use:N \l__fontscale_musical_notes_int }
+ \fp_set:Nn \l__fontscale_musical_selectfont_fp
+ {
+ \int_use:N \l__fontscale_musical_notes_int /
+ ln ( \l__fontscale_musical_ratio_fp )
+ }
+ }
}
-% Sets the font size and font baselineskip of \normalsize. Its font size must
-% be set before doing any processing involving the font scale.
-\cs_new_protected:Npn \__fontscale_keys_process_normalsize:
+\cs_new_protected:Npn \__fontscale_keys_process_sizes:
{
\quark_if_no_value:NTF \l__fontscale_normalsize_size_tl
{
\dim_set:Nn \l_fontscale_normalsize_size_dim
{
- \str_case:Vn \l__fontscale_typographic_scale_str
+ \str_if_eq:VnTF \l__fontscale_typographic_scale_str { musical }
+ { \l__fontscale_musical_base_dim }
{
- { classic-10pt } { 10pt }
- { classic-11pt } { 11pt }
- { classic-12pt } { 12pt }
- { musical } { \l__fontscale_musical_base_dim }
+ \exp_after:wN \__fontscale_keys_process_sizes:w
+ \l__fontscale_typographic_scale_str
}
}
}
@@ -567,6 +567,8 @@
{
\dim_set:Nn \l_fontscale_normalsize_size_dim
{ \l__fontscale_normalsize_size_tl }
+ \tl_set:NV \l__fontscale_normalsize_size_tl
+ \l_fontscale_normalsize_size_dim
\dim_compare:nF
{ \c_zero_dim < \l_fontscale_normalsize_size_dim < 2048pt }
{
@@ -577,76 +579,93 @@
}
\fp_set:Nn \l__fontscale_normalsize_size_fp
{ \dim_to_fp:n { \l_fontscale_normalsize_size_dim } }
- \skip_set:Nn \l_fontscale_normalsize_baselineskip_skip
+ \cs_set_eq:Nc \__fontscale_keys_process_sizes_aux:n
{
- \quark_if_no_value:NTF \l__fontscale_normalsize_baselineskip_tl
- {
- \fp_to_dim:n
- {
- \l__fontscale_normalsize_size_fp *
- \l__fontscale_baselineskip_size_ratio_fp
- }
- }
- { \l__fontscale_normalsize_baselineskip_tl }
+ __fontscale_keys_process_sizes_ \l__fontscale_typographic_scale_str :n
}
+ \tl_map_function:nN
+ {
+ {tiny} {scriptsize} {footnotesize} {small}
+ {large} {Large} {LARGE} {huge} {Huge}
+ }
+ \__fontscale_keys_process_sizes:n
+ \dim_compare:nF
+ {
+ \l_fontscale_tiny_size_dim
+ < \l_fontscale_scriptsize_size_dim
+ < \l_fontscale_footnotesize_size_dim
+ < \l_fontscale_small_size_dim
+ < \l_fontscale_normalsize_size_dim
+ < \l_fontscale_large_size_dim
+ < \l_fontscale_Large_size_dim
+ < \l_fontscale_LARGE_size_dim
+ < \l_fontscale_huge_size_dim
+ < \l_fontscale_Huge_size_dim
+ }
+ { \msg_warning:nn { fontscale } { font-sizes-wrong-order } }
}
-% Auxiliary functions that set the font size depending on the name of the font
-% size command.
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xpt:n #1
+\cs_new:Npn \__fontscale_keys_process_sizes:w #1- { }
+\tl_map_inline:nn { {pt} {bp} {dd} {nd} }
{
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \cs_new_protected:cpn { __fontscale_keys_process_sizes_classic-10#1:n } ##1
{
- \str_case:nn {#1}
+ \dim_set:cn { l_fontscale_##1_size_dim }
{
- { tiny } { 6pt }
- { scriptsize } { 7pt }
- { footnotesize } { 8pt }
- { small } { 9pt }
- { large } { 11pt }
- { Large } { 12pt }
- { LARGE } { 14pt }
- { huge } { 16pt }
- { Huge } { 18pt }
+ \str_case:nn {##1}
+ {
+ { tiny } { 6 }
+ { scriptsize } { 7 }
+ { footnotesize } { 8 }
+ { small } { 9 }
+ { large } { 11 }
+ { Large } { 12 }
+ { LARGE } { 14 }
+ { huge } { 16 }
+ { Huge } { 18 }
+ }
+ #1
}
}
- }
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xipt:n #1
- {
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \cs_new_protected:cpn { __fontscale_keys_process_sizes_classic-11#1:n } ##1
{
- \str_case:nn {#1}
+ \dim_set:cn { l_fontscale_##1_size_dim }
{
- { tiny } { 7pt }
- { scriptsize } { 8pt }
- { footnotesize } { 9pt }
- { small } { 10pt }
- { large } { 12pt }
- { Large } { 14pt }
- { LARGE } { 16pt }
- { huge } { 18pt }
- { Huge } { 21pt }
+ \str_case:nn {##1}
+ {
+ { tiny } { 7 }
+ { scriptsize } { 8 }
+ { footnotesize } { 9 }
+ { small } { 10 }
+ { large } { 12 }
+ { Large } { 14 }
+ { LARGE } { 16 }
+ { huge } { 18 }
+ { Huge } { 21 }
+ }
+ #1
}
}
- }
-\cs_new_protected:Npn \__fontscale_keys_process_other_classic_xiipt:n #1
- {
- \dim_set:cn { l_fontscale_#1_size_dim }
+ \cs_new_protected:cpn { __fontscale_keys_process_sizes_classic-12#1:n } ##1
{
- \str_case:nn {#1}
+ \dim_set:cn { l_fontscale_##1_size_dim }
{
- { tiny } { 8pt }
- { scriptsize } { 9pt }
- { footnotesize } { 10pt }
- { small } { 11pt }
- { large } { 14pt }
- { Large } { 16pt }
- { LARGE } { 18pt }
- { huge } { 21pt }
- { Huge } { 24pt }
+ \str_case:nn {##1}
+ {
+ { tiny } { 8 }
+ { scriptsize } { 9 }
+ { footnotesize } { 10 }
+ { small } { 11 }
+ { large } { 14 }
+ { Large } { 16 }
+ { LARGE } { 18 }
+ { huge } { 21 }
+ { Huge } { 24 }
+ }
+ #1
}
}
}
-\cs_new_protected:Npn \__fontscale_keys_process_other_musical:n #1
+\cs_new_protected:Npn \__fontscale_keys_process_sizes_musical:n #1
{
\dim_set:cn { l_fontscale_#1_size_dim }
{
@@ -668,61 +687,17 @@
}
}
}
-% Sets the font size, font scale, and font baselineskip of the other font size
-% commands.
-\cs_new_protected:Npn \__fontscale_keys_process_other:
+\cs_new_protected:Npn \__fontscale_keys_process_sizes:n #1
{
- \str_case:Vn \l__fontscale_typographic_scale_str
- {
- { classic-10pt }
- {
- \cs_set_eq:NN \__fontscale_keys_process_other_aux:n
- \__fontscale_keys_process_other_classic_xpt:n
- }
- { classic-11pt }
- {
- \cs_set_eq:NN \__fontscale_keys_process_other_aux:n
- \__fontscale_keys_process_other_classic_xipt:n
- }
- { classic-12pt }
- {
- \cs_set_eq:NN \__fontscale_keys_process_other_aux:n
- \__fontscale_keys_process_other_classic_xiipt:n
- }
- { musical }
- {
- \cs_set_eq:NN \__fontscale_keys_process_other_aux:n
- \__fontscale_keys_process_other_musical:n
- \fp_set:Nn \l__fontscale_musical_base_fp
- { \dim_to_fp:n { \l__fontscale_musical_base_dim } }
- \fp_set:Nn \l__fontscale_musical_notes_fp
- { \int_use:N \l__fontscale_musical_notes_int }
- \fp_set:Nn \l__fontscale_musical_selectfont_fp
- {
- \int_use:N \l__fontscale_musical_notes_int /
- ln ( \l__fontscale_musical_ratio_fp )
- }
- }
- }
- \tl_map_function:nN
- {
- {tiny} {scriptsize} {footnotesize} {small}
- {large} {Large} {LARGE} {huge} {Huge}
- }
- \__fontscale_keys_process_other:n
- }
-\cs_new_protected:Npn \__fontscale_keys_process_other:n #1
- {
\quark_if_no_value:cF { l__fontscale_#1_scale_tl }
{
+ \fp_set:Nn \l__fontscale_tmp_fp { \use:c { l__fontscale_#1_scale_tl } }
\dim_set:cn { l_fontscale_#1_size_dim }
{
\fp_to_dim:n
- {
- \l__fontscale_normalsize_size_fp *
- ( \use:c { l__fontscale_#1_scale_tl } )
- }
+ { \l__fontscale_normalsize_size_fp * \l__fontscale_tmp_fp }
}
+ \tl_set:cV { l__fontscale_#1_scale_tl } \l__fontscale_tmp_fp
\dim_compare:nF
{ \c_zero_dim < \use:c { l_fontscale_#1_size_dim } < 2048pt }
{
@@ -739,6 +714,7 @@
{
\dim_set:cn { l_fontscale_#1_size_dim }
{ \use:c { l__fontscale_#1_size_tl } }
+ \tl_set:cv { l__fontscale_#1_size_tl } { l_fontscale_#1_size_dim }
\dim_compare:nF
{ \c_zero_dim < \use:c { l_fontscale_#1_size_dim } < 2048pt }
{
@@ -755,7 +731,7 @@
}
\prg_break:
}
- \__fontscale_keys_process_other_aux:n {#1}
+ \__fontscale_keys_process_sizes_aux:n {#1}
\prg_break:
\prg_break_point:
\fp_set:cn { l_fontscale_#1_scale_fp }
@@ -763,46 +739,66 @@
\dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } } /
\l__fontscale_normalsize_size_fp
}
- \skip_set:cn { l_fontscale_#1_baselineskip_skip }
+ }
+\cs_new_protected:Npn \__fontscale_keys_process_baselineskips:
+ {
+ \tl_map_function:nN
{
- \quark_if_no_value:cTF { l__fontscale_#1_baselineskip_tl }
+ {tiny} {scriptsize} {footnotesize} {small} {normalsize}
+ {large} {Large} {LARGE} {huge} {Huge}
+ }
+ \__fontscale_keys_process_baselineskips:n
+ }
+\cs_new_protected:Npn \__fontscale_keys_process_baselineskips:n #1
+ {
+ \quark_if_no_value:cF { l__fontscale_#1_baselineskip_size_ratio_tl }
+ {
+ \fp_set:Nn \l__fontscale_tmp_fp
+ { \use:c { l__fontscale_#1_baselineskip_size_ratio_tl } }
+ \skip_set:cn { l_fontscale_#1_baselineskip_skip }
{
\fp_to_dim:n
{
\dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } } *
- \l__fontscale_baselineskip_size_ratio_fp
+ \l__fontscale_tmp_fp
}
}
+ \tl_set:cV { l__fontscale_#1_baselineskip_size_ratio_tl }
+ \l__fontscale_tmp_fp
+ \quark_if_no_value:cT { l__fontscale_#1_baselineskip_tl }
+ { \prg_break: }
+ }
+ \quark_if_no_value:cF { l__fontscale_#1_baselineskip_tl }
+ {
+ \skip_set:cn { l_fontscale_#1_baselineskip_skip }
{ \use:c { l__fontscale_#1_baselineskip_tl } }
+ \tl_set:cv { l__fontscale_#1_baselineskip_tl }
+ { l_fontscale_#1_baselineskip_skip }
+ \quark_if_no_value:cF { l__fontscale_#1_baselineskip_size_ratio_tl }
+ {
+ \msg_warning:nnn { fontscale }
+ { key-name-baselineskip-size-ratio-overwritten } {#1}
+ }
+ \prg_break:
}
- }
-% Issues a warning if the font sizes are not in the correct order.
-\cs_new_protected:Npn \__fontscale_keys_process_check_order:
- {
- \dim_compare:nF
+ \skip_set:cn { l_fontscale_#1_baselineskip_skip }
{
- \l_fontscale_tiny_size_dim
- < \l_fontscale_scriptsize_size_dim
- < \l_fontscale_footnotesize_size_dim
- < \l_fontscale_small_size_dim
- < \l_fontscale_normalsize_size_dim
- < \l_fontscale_large_size_dim
- < \l_fontscale_Large_size_dim
- < \l_fontscale_LARGE_size_dim
- < \l_fontscale_huge_size_dim
- < \l_fontscale_Huge_size_dim
+ \fp_to_dim:n
+ {
+ \dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } } *
+ \l__fontscale_baselineskip_size_ratio_fp
+ }
}
- { \msg_warning:nn { fontscale } { font-sizes-wrong-order } }
+ \prg_break:
+ \prg_break_point:
}
%%> \section{Document commands}
% Defines the standard LaTeX font size commands from \tiny to \Huge and
-% initializes to \normalsize. Sets \@currsize only for compatibility. Need
-% \dim_use:N only for compatibility with versions of the microtype package
-% older than v3.2 2024-12-12. The internal functions are not used elsewhere for
-% compatibility with hooks such as
-% \AddToHook{cmd/<font size command>/after}{<code>}.
+% initializes to \normalsize. Sets \@currsize only for compatibility. The
+% internal functions are not used elsewhere for compatibility with hooks such
+% as \AddToHook{cmd/<font size command>/after}{<code>}.
\tl_map_inline:nn
{
{tiny} {scriptsize} {footnotesize} {small} {normalsize}
@@ -826,12 +822,20 @@
\cs_set_eq:NN \exp_not:N \@currsize \exp_not:c {#1}
\exp_not:N \fontsize
{ \exp_not:N \dim_use:N \exp_not:c { l_fontscale_#1_size_dim } }
- \exp_not:c { l_fontscale_#1_baselineskip_skip }
+ {
+ \exp_not:N \skip_use:N
+ \exp_not:c { l_fontscale_#1_baselineskip_skip }
+ }
\exp_not:N \selectfont
}
}
\normalsize
+\NewExpandableDocumentCommand \currentnormalsize { }
+ { \__fontscale_normalsize_size: }
+\cs_new:Npn \__fontscale_normalsize_size:
+ { \dim_use:N \l_fontscale_normalsize_size_dim }
+
\NewExpandableDocumentCommand \currentfontstep { } { \__fontscale_step: }
\cs_new:Npn \__fontscale_step:
{ \fp_if_nan:nF { \l_fontscale_step_fp } { \fp_use:N \l_fontscale_step_fp } }
@@ -993,8 +997,12 @@
\__fontscale_set_font_baselineskip:n
{ (#1) + \l_fontscale_baselineskip_skip }
}
-\cs_new_protected:Npn \__fontscale_set_font_baselineskip:n
- { \__fontscale_set_font_size:nn { \l_fontscale_size_dim } }
+\cs_new_protected:Npn \__fontscale_set_font_baselineskip:n #1
+ {
+ \exp_args:Nne \fontsize { \dim_use:N \l_fontscale_size_dim }
+ { \skip_eval:n {#1} }
+ \selectfont
+ }
\NewDocumentCommand \printfontsizeparameters { }
{ \__fontscale_print_font_size_parameters: }
@@ -1029,8 +1037,7 @@
\token_to_str:c {##1} \@ \c_colon_str \c_space_tl
step~ =~ \fp_use:c { c_fontscale_##1_step_fp } ,~
scale~ =~
- \str_if_eq:nnTF {##1} { normalsize }
- { 1 }
+ \str_if_eq:nnTF {##1} { normalsize } { 1 }
{
\__fontscale_fp_eval_round:n
{ \use:c { l_fontscale_##1_scale_fp } }
More information about the tex-live-commits
mailing list.