Re: [NTG-context] Specifying font size as x-height
Perfect, thank you very much Max! On Sat, May 28, 2022 at 10:40 AM Max Chernoff wrote: > On 2022-05-28 2:27 a.m., Stefan Nedeljkovic wrote: > > One slight problem is when I use 2\measured{xheight} as the font size I > > get an error. \measure works fine though. > > The old version expected direct input, not a \dimen. Try this: > > \starttexdefinition setxheight [#1][#2] > \switchtobodyfont[#1, 12pt] > \scratchdimen=\dimexpr#2\relax > \switchtobodyfont[#1, \cldcontext{tex.dimen.scratchdimen / > tex.sp"1ex" * tex.sp"1em" .. "sp"}] > \stoptexdefinition > > \definemeasure[xheight][2.5pt] > > \starttext > \setxheight[adventor][10\measured{xheight}] Hello! > \stoptext > > > -- Max > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Specifying font size as x-height
On 2022-05-28 2:27 a.m., Stefan Nedeljkovic wrote: One slight problem is when I use 2\measured{xheight} as the font size I get an error. \measure works fine though. The old version expected direct input, not a \dimen. Try this: \starttexdefinition setxheight [#1][#2] \switchtobodyfont[#1, 12pt] \scratchdimen=\dimexpr#2\relax \switchtobodyfont[#1, \cldcontext{tex.dimen.scratchdimen / tex.sp"1ex" * tex.sp"1em" .. "sp"}] \stoptexdefinition \definemeasure[xheight][2.5pt] \starttext \setxheight[adventor][10\measured{xheight}] Hello! \stoptext -- Max ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Specifying font size as x-height
One slight problem is when I use 2\measured{xheight} as the font size I get an error. \measure works fine though. On Sat, May 28, 2022 at 9:34 AM Stefan Nedeljkovic wrote: > Awesome, thank you very much Max! > > On Sat, May 28, 2022 at 8:49 AM Max Chernoff wrote: > >> > 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 >> > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Specifying font size as x-height
Awesome, thank you very much Max! On Sat, May 28, 2022 at 8:49 AM Max Chernoff wrote: > > 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 > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Specifying font size as x-height
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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___