Opentype feature auto-disable?
Beau Williamson
Posts: 80
I've been searching around for any way to automatically disable an open type feature when a second feature is activated (within the opentype coding). For example, I don't want discretionary ligatures to be on when the user switches to smallcaps. I am imaging something like:
feature smcp { #Small Capitals
# DEFAULT script latn;
feature @dlig = off;
sub @lowercase by @smallcaps;
} smcp;
Of course 'feature @dlig = off' doesn't exist, but is something like this possible? I find building small cap ligatures an inelegant solution.
feature smcp { #Small Capitals
# DEFAULT script latn;
feature @dlig = off;
sub @lowercase by @smallcaps;
} smcp;
Of course 'feature @dlig = off' doesn't exist, but is something like this possible? I find building small cap ligatures an inelegant solution.
Tagged:
0
Comments
-
It is not possible the way you show it, but you can ensure the smcp lookup and/or feature is first in the list. That will first process that lookup, so all lower case characters are replaced by small caps prior to processing dlig.
2 -
Thank you for the reply,
I was thinking more of- if the user has already applied dlig, and then turns on small caps, I want them to be protected from their own inattentiveness. Applying small caps will automatically turn off other features that conflict.
I tried just adding a sub before:
sub s_t by s t;
sub @lowercase by @smallcaps;
but that doesn't work.
Maybe I'll try that zero width space thing... sub s_t by s zeroWidthSpace t;
Again. It doesn't seem elegant. I suppose I'll have to trust users to notice and turn off unwanted ligatures.0 -
If you put the {scmp} feature ahead of the {dlig} feature in the order of your feature file, then the Small Caps will supercede, and take precedence over, the Discretionary Ligatures (as Erwin pointed out).
feature smcp {<br> sub @lowercase by @smallcaps;<br> } smcp;<br><br> feature dlig {<br> sub s t by s_t;<br> } dlig;<br>
This happens regardless of the order in which the features are applied by the end user.
The text processing engine gathers all activated features and then applies them in the order in which they are compiled in the font. So, if both Discretionary Ligatures and Small Caps are applied, but it encounters the rules for {smcp} first, then a sequence of “st” will first get turned into /s.smcp /t.smcp first — at which point, there is no longer a target of “st” for the {dlig} rule to replace with /s_t and that rule becomes moot in this setting now.
So, the relevant concept in OT Layout Features is not how can a given rule turn off others, but rather how might a given rule intercept and prevent others. That’s the way you have to think about it.
3 -
The text processing engine gathers all activated features and then applies them in the order in which they are compiled in the font.
There are some hard-coded order in layout engines (and some time differ per script), but this is uasually for features that should be applied by default not optional ones.
3 -
Ok, thanks.
I will try that out.0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 800 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports