ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \doiffontfeature
@ 2009-05-07 11:53 Wolfgang Schuster
  2009-05-07 13:01 ` \doiffontfeature Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2009-05-07 11:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

is it possible to check if a font has a certain feature like smallcaps?

Wolfgang

___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: \doiffontfeature
  2009-05-07 11:53 \doiffontfeature Wolfgang Schuster
@ 2009-05-07 13:01 ` Hans Hagen
  2009-05-07 13:22   ` \doiffontfeature Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2009-05-07 13:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:
> Hi,
> 
> is it possible to check if a font has a certain feature like smallcaps?

\startluacode
     function commands.doifelsecurrentfonthasfeature(name)
         local f = fonts.ids[font.current()]
         f = f and f.shared
         f = f and f.otfdata
         f = f and f.luatex
         f = f and f.features
         commands.doifelse(f and (f.gpos[name] or f.gsub[name]))
     end
\stopluacode

\def\doifelsecurrentfonthasfeature#1%
   {\ctxlua{commands.doifelsecurrentfonthasfeature("#1")}}

\doifelsecurrentfonthasfeature{smcp}{YES}{NO}
\doifelsecurrentfonthasfeature{crap}{YES}{NO}
\doifelsecurrentfonthasfeature{kern}{YES}{NO}

for arbitrary fonts by names is doable but tricky in the sense that we 
then need to load the font which is costly

-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: \doiffontfeature
  2009-05-07 13:01 ` \doiffontfeature Hans Hagen
@ 2009-05-07 13:22   ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2009-05-07 13:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 07.05.2009 um 15:01 schrieb Hans Hagen:

> Wolfgang Schuster wrote:
>> Hi,
>> is it possible to check if a font has a certain feature like  
>> smallcaps?
>
> \startluacode
>    function commands.doifelsecurrentfonthasfeature(name)
>        local f = fonts.ids[font.current()]
>        f = f and f.shared
>        f = f and f.otfdata
>        f = f and f.luatex
>        f = f and f.features
>        commands.doifelse(f and (f.gpos[name] or f.gsub[name]))
>    end
> \stopluacode
>
> \def\doifelsecurrentfonthasfeature#1%
>  {\ctxlua{commands.doifelsecurrentfonthasfeature("#1")}}
>
> \doifelsecurrentfonthasfeature{smcp}{YES}{NO}
> \doifelsecurrentfonthasfeature{crap}{YES}{NO}
> \doifelsecurrentfonthasfeature{kern}{YES}{NO}

Nice, I will keep this in mind.

> for arbitrary fonts by names is doable but tricky in the sense that  
> we then need to load the font which is costly

Can you show me the code, this is what I'm interested in and the check
did only happen once at the begin of the document.

Wolfgang

___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-05-07 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-07 11:53 \doiffontfeature Wolfgang Schuster
2009-05-07 13:01 ` \doiffontfeature Hans Hagen
2009-05-07 13:22   ` \doiffontfeature Wolfgang Schuster

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