ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* low level fonts
@ 2004-11-25 10:41 Adam Lindsay
  2004-11-25 12:11 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Lindsay @ 2004-11-25 10:41 UTC (permalink / raw)


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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: low level fonts
  2004-11-25 10:41 low level fonts Adam Lindsay
@ 2004-11-25 12:11 ` Hans Hagen
  2004-11-25 13:48   ` Adam Lindsay
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2004-11-25 12:11 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: low level fonts
  2004-11-25 12:11 ` Hans Hagen
@ 2004-11-25 13:48   ` Adam Lindsay
  2004-11-25 15:09     ` Adam Lindsay
  2004-11-25 16:28     ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Lindsay @ 2004-11-25 13:48 UTC (permalink / raw)


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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: low level fonts
  2004-11-25 13:48   ` Adam Lindsay
@ 2004-11-25 15:09     ` Adam Lindsay
  2004-11-25 16:28     ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Lindsay @ 2004-11-25 15:09 UTC (permalink / raw)


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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: low level fonts
  2004-11-25 13:48   ` Adam Lindsay
  2004-11-25 15:09     ` Adam Lindsay
@ 2004-11-25 16:28     ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2004-11-25 16:28 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-25 16:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-25 10:41 low level fonts Adam Lindsay
2004-11-25 12:11 ` Hans Hagen
2004-11-25 13:48   ` Adam Lindsay
2004-11-25 15:09     ` Adam Lindsay
2004-11-25 16:28     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).