[NTG-context] Scaling down symbols and emojis

User 19087 se.user19087 at gmail.com
Fri Jan 18 22:44:25 CET 2019


On Wed, Jan 16, 2019 at 6:29 PM User 19087 <se.user19087 at gmail.com> wrote:
>> Or I use {\switchtobodyfont[...]\symbol[ShortForty]} in the document.
>> At that point the body font may have been switched to a size whose
>> environment defines different values for 'x' and 'xx'. Or perhaps the
>> current or default body font, via \definebodyfont, overrides the 'x'
>> and 'xx' sizes. In either case it would be more flexible to query the
>> current values of 'x' and 'xx' rather than hardcoding the values of
>> 'n' and 'm'.

On Fri, Jan 18, 2019 at 6:47 AM Wolfgang Schuster
<wolfgang.schuster.lists at gmail.com> wrote:
> The default sizes (12pt, 14.4pt etc,) set the x and xx sizes to a fixed
> size which leads
> to differences and the scale factor.

That's yet another reason to avoiding fixing the values of the 'm' and
'n' sizes. As of now, you have to first decide your font size, lookup
the 'x' and 'xx' sizes in font-pre.mkiv and do a little math... every
time you switch fonts. Instead I've come up with a function that
doesn't depend on hardcoded globals:

\define[2]\tosize{%
    \setbox0=\hbox{\tf x}%
    \setbox1=\hbox{#1 x}%
    \startluacode
    tex.dimen[2] = tex.getdimen("bodyfontsize") * tex.box[1].height /
tex.box[0].height
    \stopluacode%
    {\switchtobodyfont[\the\dimen2]#2}%
}

\tosize{\tfx}{\symbol[ShortForty]}


However I worry that measuring individual letter sizes to deduce the
actual font size may not be foolproof, especially with optical sizes
and so on. There must be some other method (at least via luatex) to
obtain the 'x' and 'xx' sizes as workable dimensions.

thanks,


More information about the ntg-context mailing list