ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \doiffontfeature
Date: Thu, 7 May 2009 15:22:02 +0200	[thread overview]
Message-ID: <832CD176-07A6-445B-86CA-AD79A14113E8@gmail.com> (raw)
In-Reply-To: <4A02DB98.6030006@wxs.nl>


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
___________________________________________________________________________________


      reply	other threads:[~2009-05-07 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 11:53 \doiffontfeature Wolfgang Schuster
2009-05-07 13:01 ` \doiffontfeature Hans Hagen
2009-05-07 13:22   ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=832CD176-07A6-445B-86CA-AD79A14113E8@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).