[NTG-context] Specifying font size as x-height
Max Chernoff
mseven at telus.net
Sat May 28 08:49:34 CEST 2022
> How would one specify the font size in LMTX, but via x-height?
You could try this:
\starttexdefinition setxheight [#1][#2]
\switchtobodyfont[#1, 12pt]
\switchtobodyfont[#1, \cldcontext{tex.sp"#2" / tex.sp"1ex" * tex.sp"1em" .. "sp"}]
\stoptexdefinition
Demo:
\starttexdefinition setxheight [#1][#2]
\switchtobodyfont[#1, 12pt]
\switchtobodyfont[#1, \cldcontext{tex.sp"#2" / tex.sp"1ex" * tex.sp"1em" .. "sp"}]
\stoptexdefinition
\define[1]\sample{%
\setxheight[#1][10pt] Hello%
}
\setuppapersize[letter, landscape]
\starttext
\dontleavehmode\rlap{\vrule width\textwidth height 10.5pt depth -10pt}%
\processcommalist[modern, pagella, termes, heros, bonum, scholas, adventor, cursor, chorus, dejavu]\sample
\stoptext
This is kind of a hacky solution though. It works reasonably well,
although there's likely a better (perhaps builtin?) way to do this.
-- Max
More information about the ntg-context
mailing list