![](https://secure.gravatar.com/avatar/a5d42c1ccacf33c72fd502fe1bb5ffa9.jpg?s=120&d=mm&r=g)
hi all. what's your best way of getting the current font name, regardless of how it's set (e.g., typescript, unicode, definedfont, low-level \font definitions...)? I certainly know about \truefontname{}, but what to put in the braces? -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Adam Lindsay wrote:
hi all.
what's your best way of getting the current font name, regardless of how it's set (e.g., typescript, unicode, definedfont, low-level \font definitions...)?
I certainly know about \truefontname{}, but what to put in the braces?
tex: \fontname\font also in context: \purefontname\font \font\myfont AdamBold at 123pt \fontname \myfont -> AdamBold at 123pt \purefontname\myfont -> AdamBold so, \definefont[Whatever][\purefontname{\font} at 24.56pt] is probably what you're looking for Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/a5d42c1ccacf33c72fd502fe1bb5ffa9.jpg?s=120&d=mm&r=g)
Hans Hagen said this at Thu, 25 Nov 2004 13:11:49 +0100:
tex: \fontname\font
Thanks Hans. That's reliable.
also in context: \purefontname\font
This fails with the XeTeX quoted-with-spaces fonts (just gives "Chaparral ) . I wasn't looking to test that sort of thing, but there you go. Clearly \def\splitoffpurefontname#1 #2\\{#1} isn't enough. :/ -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
![](https://secure.gravatar.com/avatar/a5d42c1ccacf33c72fd502fe1bb5ffa9.jpg?s=120&d=mm&r=g)
Adam Lindsay said this at Thu, 25 Nov 2004 13:48:40 +0000:
Clearly \def\splitoffpurefontname#1 #2\\{#1} isn't enough. :/
To answer my own question, this (in spec-xtx?) should be enough (I wanted the quotes stripped so that I could insert things): \def\purefontname#1% {\doiffirstcharelse"{\expandafter\string\fontname#1}% {\expandafter\dodqpurefontname} {\expandafter\dopurefontname} #1\relax} \def\dopurefontname#1% {\expandafter\splitoffpurefontname\fontname#1 \\} \def\splitoffpurefontname#1 #2\\{#1} %D No single-quote version is needed now because %D \XETEX\ returns double-quotes. \def\dodqpurefontname#1% {\expandafter\dododqpurefontname\fontname#1 \\} \def\dododqpurefontname"#1"#2\\{#1} -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Adam Lindsay wrote:
Clearly \def\splitoffpurefontname#1 #2\\{#1} isn't enough. :/
if this fails ... \unprotected \def\purefontname#1% {\@EA\splitoffpurefontname\@EA{\@EA\unstringed\fontname#1} \\} ... then you're stuck for a few days (tomorrow i'm away) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Adam Lindsay
-
Hans Hagen