![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Hi, There is a new experimental feature and (at least for now) it's also called \feature (maybe not the best name). Many fonts have language dependent features. There are also features that one only wants to enable in small text snippets. For this we have \addff etc but these don't accumulate. The next example demonstrates an accumulator. \setupbodyfont[pagella] \starttext % When the (again experimental) setup for 'font' is used, the % features will also adapt themselves to the language. I'm % still considering on how to deal with the main language. % \definefontfeature[nl][language=nld,script=latn] \setuplanguages[font=auto] % \setuplanguage [default][font=auto] % \setuplanguage [nl][font=auto] % We need to make a nice set of 'simple' switchers. \definefontfeature[f:smallcaps][smcp=yes] \definefontfeature[f:nocaps] [smcp=no] \definefontfeature[f:oldstyle] [onum=yes] \definefontfeature[f:newstyle] [onum=no] % watch how features accumulate \startTEXpage[offset=10pt] fijn fietsen 123 \feature{f:oldstyle} fijn fietsen 123 \feature{f:smallcaps} fijn fietsen 123 \feature{f:oldstyle} fijn fietsen 123 \start \nl % \feature{nl} fijn fietsen 123 \de fijn fietsen 123 \stop fijn fietsen 123 \feature{f:newstyle} fijn fietsen 123 \feature{f:nocaps} fijn fietsen 123 \stopTEXpage % watch how lm has contextual lookups for ligatures % that depend on the language \startTEXpage[offset=10pt] \definedfont[lmroman10-regular*default] fijn fietsen \nl fijn fietsen \de fijn fietsen \stopTEXpage \stoptext This mechanism is (just as \addff cum suis) somewhat slower but as long as it's used grouped, performance is quite ok. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
Hi Hans,
This is interesting, because I was thinking about this issue this past
weak, and was planning to send a test file:
On Thu, 14 Mar 2013 17:39:50 -0600, Hans Hagen
There is a new experimental feature and (at least for now) it's also called \feature (maybe not the best name).
\stack might be better, for the following reason:
Many fonts have language dependent features. There are also features that one only wants to enable in small text snippets. For this we have \addff etc but these don't accumulate.
We used to have \addfs{<feature>} and \subfs{<feature>}, meaning "add feature to the stack" and "subtract feature from the stack". But those have been broken for a very long time. To round it off I guess we need a replacement for \subfs as well. Thanks for this wonderful new feature (pun intended) and Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Thu, 14 Mar 2013 20:08:38 -0600, Idris Samawi Hamid ادريس سماوي حامد
To round it off I guess we need a replacement for \subfs as well.
Hmm, it seems that \subfs functionality is built in through the same mechanism. Will study this some more... Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 5:18 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
On Thu, 14 Mar 2013 20:08:38 -0600, Idris Samawi Hamid ادريس سماوي حامد
wrote: To round it off I guess we need a replacement for \subfs as well.
Hmm, it seems that \subfs functionality is built in through the same mechanism. Will study this some more...
yes, but there in successive calls the last one counts \addff{x} \addff{y} \addff{z} -> z is used on top of the current font's set \feature{x} \feature{y} \feature{y} -> all are used on top we might end up with replacing \addff etc by one mechanisms \feature{+someset} : add \feature{-someset} : subtract \feature{=someset} : replace Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/144fbc1c04a270920a513002e37a7857.jpg?s=120&d=mm&r=g)
On Fri, Mar 15, 2013 at 4:35 AM, Hans Hagen
On 3/15/2013 5:18 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
On Thu, 14 Mar 2013 20:08:38 -0600, Idris Samawi Hamid ادريس سماوي حامد
wrote: To round it off I guess we need a replacement for \subfs as well.
Hmm, it seems that \subfs functionality is built in through the same mechanism. Will study this some more...
yes, but there in successive calls the last one counts
\addff{x} \addff{y} \addff{z} -> z is used on top of the current font's set
\feature{x} \feature{y} \feature{y} -> all are used on top
we might end up with replacing \addff etc by one mechanisms
\feature{+someset} : add \feature{-someset} : subtract \feature{=someset} : replace
I like this proposal for its use of only a single command with the add/remove/reset in the args. If \feature ends up being too generic, maybe \fontfeature or \fontfeatureset instead? To keep things more in-line with current ConTeXt syntax, you could do something like the following: \feature{add=foo} \feature{subtract=bar} (or sub, remove, etc.) \feature{reset,add=baz} Which would also allow, e.g., \feature{add=bar,remove=baz} similar to how we're used to using key:value pairs in so many arguments, and being able to combine them in one function call. Jon
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 6:16 PM, Jonathan Barchi wrote:
On Fri, Mar 15, 2013 at 4:35 AM, Hans Hagen
wrote: On 3/15/2013 5:18 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
On Thu, 14 Mar 2013 20:08:38 -0600, Idris Samawi Hamid ادريس سماوي حامد
wrote: To round it off I guess we need a replacement for \subfs as well.
Hmm, it seems that \subfs functionality is built in through the same mechanism. Will study this some more...
yes, but there in successive calls the last one counts
\addff{x} \addff{y} \addff{z} -> z is used on top of the current font's set
\feature{x} \feature{y} \feature{y} -> all are used on top
we might end up with replacing \addff etc by one mechanisms
\feature{+someset} : add \feature{-someset} : subtract \feature{=someset} : replace
I like this proposal for its use of only a single command with the add/remove/reset in the args. If \feature ends up being too generic, maybe \fontfeature or \fontfeatureset instead?
To keep things more in-line with current ConTeXt syntax, you could do something like the following:
\feature{add=foo} \feature{subtract=bar} (or sub, remove, etc.) \feature{reset,add=baz}
Which would also allow, e.g.,
\feature{add=bar,remove=baz}
I'd like to avoid parsing as much as possible here as these are state changers. So, I made: \addfeature [f:mine] \feature[more][f:mine] \feature[+] [f:mine] \subtractfeature[f:mine] \feature[less][f:mine] \feature[-] [f:mine] \replacefeature [f:mine] \feature[new] [f:mine] \feature[=] [f:mine] \revivefeature [f:mine] \feature[old] [f:mine] \feature[default][f:mine] \resetfeature \feature[reset] so there are several ways to achieve the same (and one can use {} instead of [])
similar to how we're used to using key:value pairs in so many arguments, and being able to combine them in one function call.
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 5:18 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
On Thu, 14 Mar 2013 20:08:38 -0600, Idris Samawi Hamid ادريس سماوي حامد
wrote: To round it off I guess we need a replacement for \subfs as well.
Hmm, it seems that \subfs functionality is built in through the same mechanism. Will study this some more...
a new beta, this time with: \setupbodyfont[pagella] \starttext \definefontfeature[f:smallcaps][smcp=yes] \definefontfeature[f:nocaps] [smcp=no] \definefontfeature[f:oldstyle] [onum=yes] \definefontfeature[f:newstyle] [onum=no] % \enabletrackers[fonts.features] \startTEXpage[offset=10pt] \start fijn fietsen 123 \type{[+os]}\feature{f:oldstyle} fijn fietsen 123 \type{[+sc]}\feature{f:smallcaps} fijn fietsen 123 \type{[+ns]}\feature{f:newstyle} fijn fietsen 123 \type{[+nc]}\feature{f:nocaps} fijn fietsen 123 \stop \par \start fijn fietsen 123 \type{[+os]}\addfeature{f:oldstyle} fijn fietsen 123 \type{[+sc]}\addfeature{f:smallcaps} fijn fietsen 123 \type{[-os]}\subtractfeature{f:oldstyle} fijn fietsen 123 \type{[-sc]}\subtractfeature{f:smallcaps} fijn fietsen 123 \stop \par \start fijn fietsen 123 \type{[+os]}\addfeature{f:oldstyle} fijn fietsen 123 \type{[+sc]}\addfeature{f:smallcaps} fijn fietsen 123 \type{[=os]}\replacefeature{f:oldstyle} fijn fietsen 123 \type{[=sc]}\replacefeature{f:smallcaps} fijn fietsen 123 \stop \par \start fijn fietsen 123 \type{[+os]}\addfeature[f:oldstyle] fijn fietsen 123 \type{[+sc]}\addfeature[f:smallcaps] fijn fietsen 123 \type{[reset]}\resetfeature fijn fietsen 123 \type{[+os]}\addfeature[f:oldstyle] fijn fietsen 123 \type{[+sc]}\addfeature[f:smallcaps] fijn fietsen 123 \stop \stopTEXpage \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 15 Mar 2013 05:07:02 -0600, Hans Hagen
\start fijn fietsen 123 \type{[+os]}\addfeature{f:oldstyle} fijn fietsen 123 \type{[+sc]}\addfeature{f:smallcaps} fijn fietsen 123 \type{[=os]}\replacefeature{f:oldstyle} fijn fietsen 123 \type{[=sc]}\replacefeature{f:smallcaps} fijn fietsen 123 \stop
So I hope I have this right: \addfeature adds a set of features {<feature1>,<feature2>,...<featureN>} to the currently defined/enabled stack of OT features \subtractfeature subtracts a set of features from the currently defined/enabled stack These two seem clear enough. I'm not so clear on the next one: \replacefeature replaces all the _added_ features (not the default ones defined, e.g., in the typescripts I presume) with only those in the argument of \replacefeature. Is that right? \resetfeature pops all features added to the stack (again, I'm assuming this does not include the default ones defined, e.g., in the typescripts). Question: Does/Will this mechanism completely replace \addff et al, or will these mechanism ignore each other (e.g., \resetfeature does not pop those defined by \addff). Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 7:11 PM, Idris Samawi Hamid ادريس سماوي حامد wrote:
On Fri, 15 Mar 2013 05:07:02 -0600, Hans Hagen
wrote: \start fijn fietsen 123 \type{[+os]}\addfeature{f:oldstyle} fijn fietsen 123 \type{[+sc]}\addfeature{f:smallcaps} fijn fietsen 123 \type{[=os]}\replacefeature{f:oldstyle} fijn fietsen 123 \type{[=sc]}\replacefeature{f:smallcaps} fijn fietsen 123 \stop
So I hope I have this right:
\addfeature adds a set of features {<feature1>,<feature2>,...<featureN>} to the currently defined/enabled stack of OT features
no, it adds a *predefined* featureset to the set of the current font but forgets them when a group is left
\subtractfeature subtracts a set of features from the currently defined/enabled stack
idem but subtraction
These two seem clear enough. I'm not so clear on the next one:
\replacefeature replaces all the _added_ features (not the default ones defined, e.g., in the typescripts I presume) with only those in the argument of \replacefeature. Is that right?
This reverts back to the features that are set when the font is defined and adds the given set. Resetting the stack in your speak.
\resetfeature pops all features added to the stack (again, I'm assuming this does not include the default ones defined, e.g., in the typescripts).
This reverts back to the features that are set when the font is defined.
Question: Does/Will this mechanism completely replace \addff et al, or will these mechanism ignore each other (e.g., \resetfeature does not pop those defined by \addff).
I dont' know ... in fact, they share code deep down in the machinery but indeed it might make sense to remove them (or at least depricate them). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 7:11 PM, Idris Samawi Hamid ادريس سماوي حامد wrote:
So I hope I have this right:
\addfeature adds a set of features {<feature1>,<feature2>,...<featureN>} to the currently defined/enabled stack of OT features
\subtractfeature subtracts a set of features from the currently defined/enabled stack
These two seem clear enough. I'm not so clear on the next one:
\replacefeature replaces all the _added_ features (not the default ones defined, e.g., in the typescripts I presume) with only those in the argument of \replacefeature. Is that right?
\resetfeature pops all features added to the stack (again, I'm assuming this does not include the default ones defined, e.g., in the typescripts).
Question: Does/Will this mechanism completely replace \addff et al, or will these mechanism ignore each other (e.g., \resetfeature does not pop those defined by \addff).
A good exercise in understanding this is to add this to the wiki. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 3/15/2013 3:08 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
Hi Hans,
This is interesting, because I was thinking about this issue this past weak, and was planning to send a test file:
On Thu, 14 Mar 2013 17:39:50 -0600, Hans Hagen
wrote: There is a new experimental feature and (at least for now) it's also called \feature (maybe not the best name).
\stack might be better, for the following reason:
hm, one problem with such nice names is that they might be in use in user definitions
Many fonts have language dependent features. There are also features that one only wants to enable in small text snippets. For this we have \addff etc but these don't accumulate.
We used to have \addfs{<feature>} and \subfs{<feature>}, meaning "add feature to the stack" and "subtract feature from the stack". But those have been broken for a very long time.
afaik they're not broken but they don't stack up, only the last one counts (for a good technical reasons)
To round it off I guess we need a replacement for \subfs as well.
that can be done by defining the proper 'reset' features (see demo code), keep in mind that when feature switches are in macros one never really knows what is 'current' so it's already quite fuzzy; of course we can think of a negate option (i.e. use the negation of a feature set but that can be dangerous as when features inherit one doesn't want to disable kerning (for instance)
Thanks for this wonderful new feature (pun intended) and
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Idris Samawi Hamid ادريس سماوي حامد
-
Jonathan Barchi