![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Hi, is it possible to check if a font has a certain feature like smallcaps? Wolfgang
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
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
participants (2)
-
Hans Hagen
-
Wolfgang Schuster