texlive[70882] Master/texmf-dist: fontscale (7apr24)
commits+karl at tug.org
commits+karl at tug.org
Sun Apr 7 21:57:11 CEST 2024
Revision: 70882
https://tug.org/svn/texlive?view=revision&revision=70882
Author: karl
Date: 2024-04-07 21:57:11 +0200 (Sun, 07 Apr 2024)
Log Message:
-----------
fontscale (7apr24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex
trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex 2024-04-07 19:57:04 UTC (rev 70881)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex 2024-04-07 19:57:11 UTC (rev 70882)
@@ -13,7 +13,7 @@
Oliver Beery
-Version 1.1.0\quad{}31 March 2024
+Version 1.1.1\quad{}7 April 2024
\section{Introduction}
@@ -75,7 +75,7 @@
\label{subsec:terminology}
When using the \pkg{fontscale} package, each font size, including the standard font size commands from \cs{tiny} to \cs{Huge}, has a step, scale, size, and baselineskip.
-The latter two parameters are the familiar first and second arguments to the low\-/level font command \cs{fontsize}\marg{\meta{size}}\marg{\meta{baselineskip}}.
+The latter two parameters are the familiar first and second arguments to the low\-/level font command \cs{fontsize}\marg{\meta{size}}\marg{\meta{skip}}.
The font scale is the relative font size; the ratio of the font size to \cs{normalsize}.
The font step is the number of font size gradations from \cs{normalsize}, which has a step of \num{0}.
Table~\ref{table:fontsteps} lists the font step of each font size command.
@@ -183,7 +183,7 @@
\Key{\meta{font size command}}[\meta{size}]
\nopagebreak\newline
-\Key{\meta{font size command}}[\meta{size}/\meta{baselineskip}]
+\Key{\meta{font size command}}[\meta{size}/\meta{skip}]
The keys \Key{\meta{font size command}} set the keys \Key{\meta{font size command}\slash{}size} or \Key{\meta{font size command}\slash{}baselineskip} in a condensed format.
The latter format resembles traditional typographic notation where the size and leading of a text can be expressed as, for example, $10/12$ or $11/13$.
@@ -220,8 +220,8 @@
Internally, \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} use the kernel command \cs{f at size}.
\cs{CurrentFontSize} expands to \texttt{f at size pt}.
\cs{CurrentFontBaselineskip} expands to the kernel command \cs{f at baselineskip}.
-Note that the low\-/level font command \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{baselineskip}} sets \cs{f at size} before expanding its second argument.
-This means that \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} may need to be first expanded if used in \meta{baselineskip}.
+Note that the low\-/level font command \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{skip}} sets \cs{f at size} before expanding its second argument.
+This means that \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} may need to be first expanded if used in \meta{skip}.
This package provides the command \cs{SetFontSizeBaselineskip} as an alternative to \cs{fontsize} + \cs{selectfont} that avoids this issue (\S\ref{subsec:fontsize}).
\subsection{More font sizing commands}
@@ -229,7 +229,7 @@
The \pkg{fontscale} package provides the commands \cs{SetFontStep}, \cs{SetFontScale}, \cs{SetFontSize}, \cs{ScaleFont}, and \cs{SetFontSizeBaselineskip} which set the font size in different ways.
The first three commands have a starred version which sets the font size relative to the current font size.
-Internally, these commands all use the low\-/level font commands \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{baselineskip}} and \cs{selectfont}.
+Internally, these commands all use the low\-/level font commands \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{skip}} and \cs{selectfont}.
These commands should be used only in special cases.
Generally, users should prefer the font size commands from \cs{tiny} to \cs{Huge} for typographic and syntactic consistency, although \cs{SetFontStep*}\marg{\meta{integer}} can use a font size command directly.
@@ -280,15 +280,15 @@
\cs{ScaleFont}\marg{\meta{number}}
\KeepNextPar*
-Scales the current font size and the current font baselineskip by \meta{number}.
+Scales the current font size and the current font baselineskip by a factor of \meta{number}.
\cs{ScaleFont} resembles the \cs{scalefont} command provided by the \pkg{scalefnt} package, except that it uses floating point calculations and clears the stretch and shrink components of the font baselineskip.
For example, if the current font size and font baselineskip are \qty{10}{pt} and \qty{12}{pt}, using \cs{ScaleFont}\marg{0.8} will reduce them proportionally to \qty{8}{pt} and \qty{9.6}{pt}.
-\cs{SetFontSizeBaselineskip}\marg{\meta{size}}\marg{\meta{baselineskip}}
+\cs{SetFontSizeBaselineskip}\marg{\meta{size}}\marg{\meta{skip}}
\KeepNextPar*
-Sets the font size and font baselineskip to \meta{size} and \meta{baselineskip}.
-Both \meta{size} and \meta{baselineskip} supply a default unit of \unit{pt}.
+Sets the font size and font baselineskip to \meta{size} and \meta{skip}.
+Both \meta{size} and \meta{skip} 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 at size} discussed in \S\ref{subsec:fontparameters}
\vfill\pagebreak%manual
Modified: trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2024-04-07 19:57:04 UTC (rev 70881)
+++ trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2024-04-07 19:57:11 UTC (rev 70882)
@@ -8,8 +8,8 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage
{fontscale}
- {2024-03-31}
- {1.1.0}
+ {2024-04-07}
+ {1.1.1}
{A user interface for setting document font sizes}
% The 2023-10-10 l3kernel update added many 'e'-variants.
@@ -40,30 +40,15 @@
\fp_const:Nn \c_fontscale_normalsize_scale_fp { 1 }
-\seq_const_from_clist:Nn \c__fontscale_names_seq
+\tl_const:Nn \c__fontscale_names_tl
{
- tiny
- , scriptsize
- , footnotesize
- , small
- , normalsize
- , large
- , Large
- , LARGE
- , huge
- , Huge
+ {tiny} {scriptsize} {footnotesize} {small} {normalsize}
+ {large} {Large} {LARGE} {huge} {Huge}
}
-\seq_const_from_clist:Nn \c__fontscale_names_other_seq
+\tl_const:Nn \c__fontscale_names_other_tl
{
- tiny
- , scriptsize
- , footnotesize
- , small
- , large
- , Large
- , LARGE
- , huge
- , Huge
+ {tiny} {scriptsize} {footnotesize} {small}
+ {large} {Large} {LARGE} {huge} {Huge}
}
\prop_new:N \l_fontscale_tiny_prop
@@ -122,10 +107,13 @@
\skip_new:N \l_fontscale_huge_baselineskip_skip
\skip_new:N \l_fontscale_Huge_baselineskip_skip
-\fp_new:N \l__fontscale_normalsize_size_fp
\str_new:N \l__fontscale_typographic_scale_str
\tl_new:N \l__fontscale_keys_precompile_preamble_tl
+% Used in floating point expressions for speed.
+\fp_new:N \l__fontscale_normalsize_size_fp
+\fp_new:N \l__fontscale_musical_notes_fp
+
% Temporary variables
\fp_new:N \l__fontscale_step_fp
\tl_new:N \l__fontscale_step_tl
@@ -649,9 +637,9 @@
{ \skip_use:N \l_fontscale_normalsize_baselineskip_skip }
\normalsize
}
-% Sets the size, scale, and baselineskip of the other font size commands and
-% stores them in property lists. Issues a warning if the user sets both the
-% scale and size keys for the same font size command.
+% 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
{
\dim_set:cn { l_fontscale_#1_size_dim }
@@ -725,74 +713,90 @@
{
\l__fontscale_normalsize_size_fp * \l__fontscale_musical_ratio_fp
^ ( \use:c { c_fontscale_#1_step_fp }
- / \l__fontscale_musical_notes_int )
+ / \l__fontscale_musical_notes_fp )
}
}
}
\cs_new_protected:Npn \__fontscale_keys_process_other:
{
- \cs_set_eq:Nc \__fontscale_keys_process_other_typographic_scale:n
+ \str_case:on \l__fontscale_typographic_scale_str
{
- \str_case:on \l__fontscale_typographic_scale_str
- {
- { classic-10pt } { __fontscale_keys_process_other_classic_xpt:n }
- { classic-11pt } { __fontscale_keys_process_other_classic_xipt:n }
- { classic-12pt } { __fontscale_keys_process_other_classic_xiipt:n }
- { modular } { __fontscale_keys_process_other_modular:n }
- { musical } { __fontscale_keys_process_other_musical:n }
- }
+ { classic-10pt }
+ {
+ \cs_set_eq:NN \__fontscale_keys_process_other_typographic_scale:n
+ \__fontscale_keys_process_other_classic_xpt:n
+ }
+ { classic-11pt }
+ {
+ \cs_set_eq:NN \__fontscale_keys_process_other_typographic_scale:n
+ \__fontscale_keys_process_other_classic_xipt:n
+ }
+ { classic-12pt }
+ {
+ \cs_set_eq:NN \__fontscale_keys_process_other_typographic_scale:n
+ \__fontscale_keys_process_other_classic_xiipt:n
+ }
+ { modular }
+ {
+ \cs_set_eq:NN \__fontscale_keys_process_other_typographic_scale:n
+ \__fontscale_keys_process_other_modular:n
+ }
+ { musical }
+ {
+ \cs_set_eq:NN \__fontscale_keys_process_other_typographic_scale:n
+ \__fontscale_keys_process_other_musical:n
+ \fp_set:Nn \l__fontscale_musical_notes_fp
+ { \l__fontscale_musical_notes_int }
+ }
}
- \seq_map_inline:Nn \c__fontscale_names_other_seq
+ \tl_map_function:NN \c__fontscale_names_other_tl
+ \__fontscale_keys_process_other_aux:n
+ }
+\cs_new_protected:Npn \__fontscale_keys_process_other_aux:n #1
+ {
+ \quark_if_no_value:cF { l__fontscale_#1_size_tl }
{
- \quark_if_no_value:cF { l__fontscale_##1_size_tl }
+ \__fontscale_dim_set_with_default_unit:cn { l_fontscale_#1_size_dim }
+ { \use:c { l__fontscale_#1_size_tl } }
+ \quark_if_no_value:cF { l__fontscale_#1_scale_tl }
+ { \msg_warning:nnn { fontscale } { key-font-scale-ignored } {#1} }
+ \prg_break:
+ }
+ \quark_if_no_value:cF { l__fontscale_#1_scale_tl }
+ {
+ \dim_set:cn { l_fontscale_#1_size_dim }
{
- \__fontscale_dim_set_with_default_unit:cn
- { l_fontscale_##1_size_dim }
- { \use:c { l__fontscale_##1_size_tl } }
- \quark_if_no_value:cF { l__fontscale_##1_scale_tl }
+ \fp_to_dim:n
{
- \msg_warning:nnn { fontscale } { key-font-scale-ignored } {##1}
+ \l__fontscale_normalsize_size_fp
+ * ( \use:c { l__fontscale_#1_scale_tl } )
}
- \prg_break:
}
- \quark_if_no_value:cF { l__fontscale_##1_scale_tl }
+ \prg_break:
+ }
+ \prg_break:n { \__fontscale_keys_process_other_typographic_scale:n {#1} }
+ \prg_break_point:
+ \fp_set:cn { l_fontscale_#1_scale_fp }
+ { \use:c { l_fontscale_#1_size_dim } / \l__fontscale_normalsize_size_fp }
+ \quark_if_no_value:cTF { l__fontscale_#1_baselineskip_tl }
+ {
+ \skip_set:cn { l_fontscale_#1_baselineskip_skip }
{
- \dim_set:cn { l_fontscale_##1_size_dim }
+ \fp_to_dim:n
{
- \fp_to_dim:n
- {
- \l__fontscale_normalsize_size_fp
- * ( \use:c { l__fontscale_##1_scale_tl } )
- }
+ \use:c { l_fontscale_#1_size_dim }
+ * \l__fontscale_baselineskip_size_ratio_fp
}
- \prg_break:
}
- \prg_break:n
- { \__fontscale_keys_process_other_typographic_scale:n {##1} }
- \prg_break_point:
- \fp_set:cn { l_fontscale_##1_scale_fp }
- {
- \use:c { l_fontscale_##1_size_dim }
- / \l__fontscale_normalsize_size_fp
- }
- \quark_if_no_value:cTF { l__fontscale_##1_baselineskip_tl }
- {
- \skip_set:cn { l_fontscale_##1_baselineskip_skip }
- {
- \fp_to_dim:n
- {
- \use:c { l_fontscale_##1_size_dim }
- * \l__fontscale_baselineskip_size_ratio_fp
- }
- }
- }
- {
- \__fontscale_skip_set_with_default_unit:cn
- { l_fontscale_##1_baselineskip_skip }
- { \use:c { l__fontscale_##1_baselineskip_tl } }
- }
}
+ {
+ \__fontscale_skip_set_with_default_unit:cn
+ { l_fontscale_#1_baselineskip_skip }
+ { \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:
{
\prop_put:Nne \l_fontscale_tiny_prop { scale }
@@ -991,7 +995,7 @@
{
\fp_eval:n
{
- \l__fontscale_musical_notes_int
+ \l__fontscale_musical_notes_fp
* ln ( \f at size / \l__fontscale_normalsize_size_fp )
/ ln ( \l__fontscale_musical_ratio_fp )
}
@@ -1040,7 +1044,7 @@
\c_fontscale_Huge_step_fp { \Huge }
}
{
- \str_case:onTF \l__fontscale_typographic_scale_str
+ \str_case:onF \l__fontscale_typographic_scale_str
{
{ modular }
{
@@ -1052,6 +1056,11 @@
* \l__fontscale_modular_ratio_fp ^ #1
}
}
+ {
+ \fp_to_dim:n
+ { \f at size * \l__fontscale_baselineskip_size_ratio_fp }
+ }
+ \selectfont
}
{ musical }
{
@@ -1061,18 +1070,16 @@
{
\l__fontscale_normalsize_size_fp
* \l__fontscale_musical_ratio_fp
- ^ ( #1 / \l__fontscale_musical_notes_int )
+ ^ ( #1 / \l__fontscale_musical_notes_fp )
}
}
+ {
+ \fp_to_dim:n
+ { \f at size * \l__fontscale_baselineskip_size_ratio_fp }
+ }
+ \selectfont
}
}
- {
- {
- \fp_to_dim:n
- { \f at size * \l__fontscale_baselineskip_size_ratio_fp }
- }
- \selectfont
- }
{ \msg_error:nn { fontscale } { font-step-out-of-bounds } }
}
}
@@ -1165,7 +1172,7 @@
{ \__fontscale_print_all_font_parameters: }
\cs_new_protected:Npn \__fontscale_print_all_font_parameters:
{
- \seq_map_inline:Nn \c__fontscale_names_seq
+ \tl_map_inline:Nn \c__fontscale_names_tl
{
\prop_get:cnN { l_fontscale_##1_prop } { step } \l__fontscale_step_tl
\prop_get:cnN { l_fontscale_##1_prop } { scale } \l__fontscale_scale_tl
More information about the tex-live-commits
mailing list.