On 2010-12-12 Wolfgang Schuster
Maybe it is possible that the \sc macro can check if the font contains the small caps as a feature. Is there a switch like \doiffontfeatureexists{smcp}{...}?
\startluacode function commands.doifelsecurrentfonthasfeature(name) local f = fonts.identifiers[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")}}
\let\normalsc\sc \definefontfeature[smcp][smcp=yes] \definefontfeature[latn][script=latn]
\unexpanded\def\sc{\doifelsecurrentfonthasfeature{smcp}{\addfs{smcp}}\normalsc}
\starttext
\tf text \sc text
\switchtobodyfont[cambria]\addfs{latn} % cambria needs the latin script for smallcaps
\tf text \addfs{smcp} text
\switchtobodyfont[modern]
\tf text \sc text
\stoptext That's a nice piece of code! Thanks for your effort.
Marco