Re: Are fractional font sizes OK?
Wolfgang Schuster <[email protected]> Sun, 31 May 2026 13:21:55 +0200
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
Am 31.05.2026 um 12:49 schrieb Hans Hagen via ntg-context:
> On 5/31/2026 12:05 PM, Pablo Rodriguez via ntg-context wrote:
>> On 5/28/26 02:39, Jim via ntg-context wrote:
>>> Hi all,
>>> […]
>>> What do I learn from this?
>>> (a) Fractional point font sizes are not a thing, and I shouldn't do
>>> that?
>>> (b) Fractional point font sizes may work, but are unreliable?
>>> (c) \switchtobodyfont[script] doesn't work with fractional point font
>>> sizes?
>>> (d) Something else entirely?
>>
>> Hi Jim,
>>
>> just use the source: lines 654-662 from contain the explanation (or I
>> just found the fix reading those lines).
>>
>> If you use non-predefined font sizes (not just fractional, `50pt` gives
>> the same result), it seems that you have to setup the size.
>>
>> Your sample compiles fine, even with such an unorthodox approach such as:
>>
>> \definebodyfontenvironment[10.5pt]
>> [script=\cldcontext{10.5*(7/12)}pt]
>> \setupbodyfont[10.5pt]
>>
>> I hope it helps,
>
> In mkii times there we limnitation son the amount of fonts so we snapped
> sizes to 2 digits. In mkiv times that was less needed but still we snap
> in order not to get excessive definitions due to 'interesting usa
> cases'. In lmtx we scale differently but still one needs to be careful
> esp as bodyfont environments are expected to behave consistently.
>
> In principle we could discard some compatibility here but that is always
> tricky and as such some work from Wolfgang and me that we currently
> happily delay. Of course there are sentimental reasons for such a delay
> too.
An easy way to fix this problem is to limit the number of allowed
keywords to small and big.
%%%% patch for font-ini.mklx
% macros=mkvi
\unprotect
\protected\def\font_basics_switchtobodyfont#specification%
{\edef\m_font_step{\font_bodyfontvariable{#specification}}%
\font_push_x_size % experiment
\ifempty\m_font_step
\font_helpers_set_font\zerocount{#specification}%
- \else
+ \orelse\ifinset{#specification}{\v!small,\v!big}%
\font_helpers_switch_bodyfont_step % so we have a fast [small] switch
\fi
\expand\everybodyfont
\expand\everyswitchtobodyfont
\expand\everyfont
\expand\everyfontswitch
\font_pop_x_size % experiment
}
\protect
\starttext
text
\switchtobodyfont[script]
text
\switchtobodyfont[10.5pt]
\switchtobodyfont[script]
text
\switchtobodyfont[small]
text
\stoptext
%%%%
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________