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