Re: Are fractional font sizes OK?

Wolfgang Schuster <[email protected]> Mon, 1 Jun 2026 23:34:12 +0200
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Am 01.06.2026 um 17:25 schrieb Jim via ntg-context:
> On Sun, May 31, 2026 at 13:21 (+0200), Wolfgang Schuster wrote:
> 
>> 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,
> 
> thanks, that does the trick in removing the error the 10.5pt/script
> situation.
> 
> However, in my test it seems to ignore \switchtobodyfont[script] for the
> default font size.  Is this intended?
> 
> Perhaps getting an error message when asking for some undefined size like
> this is the correct thing, and the only requirement is a bit of education
> for users like me.


AFAIK script (and scriptscript) isn't meant as a named size switch and 
only used in math mode.


\setupbodyfontenvironment[30pt][script=25pt,scriptscript=20pt]

\setupbodyfont[30pt]

\starttext

\dm{a_{\text{b}_{\text{c}}}}

\setupbodyfontenvironment[30pt][script=20pt,scriptscript=10pt]

\dm{a_{\text{b}_{\text{c}}}}

\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
___________________________________________________________________________________