Cycling through Positional Alternates
Leon Coward
Posts: 4
Hello, this is my first post on TypeDrawers.
I've been learning how to code OpenType Positional Alternates (as a "calt" feature) and how to create Glyph Cycles. I'm using FontLab 7 and my tutorials for Positional Alternates & Glyph Cycles are The Unofficial OpenType Cookbook (http://opentypecookbook.com/common-techniques/) and Scheichelbauer's Features Tutorial for GlyphsApp (https://glyphsapp.com/tutorials/features-part-3-advanced-contextual-alternates).
I'm interested in cycling through positional alternates, and am not quite sure where to begin except by posting here. Maybe you have an idea how to achieve it?
Most guidance on Glyph Cycles only relate to strings of a successively repeated character ("aaaa"), rather than the sporadic appearance of a character.
Since I can't as yet code it in OpenType, the text below is of course just to illustrate my goal:
(t.init#1)to (t.init#2)thine(e.fina#1) own se(e.medi#1)lf be(e.fina#2) (t.init#1)true(e.fina#1)
Thank you for reading my question
Tagged:
0
Comments
-
Hi Leon, welcome to TypeDrawers! This is a great question. I think it's going to be very tricky to do exactly what you want, but I can get pretty close.
You need to combine two techniques. I would set up two lookups in your calt feature. (If you don't know how to create separate lookups or why they're useful, please see my Thinking In OpenType tutorial.) The first lookup will set up the init/medi/fina glyphs that you want to vary, just to get them into the first variant glyph (t.init1, e.fina1, etc. in your example). The OpenType Cookbook should have a recipe which helps you do that. I'm going to assume you can do that already.
The second lookup is the interesting one - this will be the one which cycles these glyphs through different variants. So much about programming is finding the right way to frame the question. If the question is "Can I keep track of the last variant of a glyph and change the next variant based on it?" then it seems really tough, as OpenType doesn't really have any way to save state. If you frame the question as "Can I substitute a glyph for e.g. t.init3 if it's preceded at some point in the recent past by a t.init2?" then the answer begins to write itself. You may find it easiest to understand the code below by starting reading from the middle set of rules - that'll be clearer what you're substituting for what.sub t.init1' @anything' @anything' t.init1 by t.init2; sub t.init1' @anything' @anything' @anything' t.init1 by t.init2; sub t.init1' @anything' @anything' @anything' @anything' t.init1 by t.init2; # As many lines of context as you want sub t.init2' @anything' @anything' t.init1 by t.init3; sub t.init2' @anything' @anything' @anything' t.init1 by t.init3; sub t.init2' @anything' @anything' @anything' @anything' t.init1 by t.init3; # ... sub t.init3' @anything' @anything' t.init1 by t.init4; sub t.init3' @anything' @anything' @anything' t.init1 by t.init4; sub t.init3' @anything' @anything' @anything' @anything' t.init1 by t.init4;
It will get very tedious to enumerate all the cases, but I think it should work.1 -
(Are you sure you have the tickmarks ' right?)0
-
I suggest a combination of contextual alternates in calt along with the rand feature.
0 -
Georg Seifert said:(Are you sure you have the tickmarks ' right?)
Oh, bother. Look, I got the tick marks right, Adobe got them wrong.
sub b by z; # changes b sub a' b by z; # changes a
Erwin Denissen said:I suggest a combination of contextual alternates in calt along with the rand feature.The rand feature is only implemented in Harfbuzz, so this will only work in applications using Harfbuzz - it won't work in Microsoft Word, Adobe Illustrator, TextEdit, etc. (Related thread.)
0 -
But in your example, all the context classes have a tick, too? For me, the code looks like that you like to sub the glyph just before the ‘by’. But that has not mark. Or do I miss something?0
-
You are right, I did get it wrong - only the final glyph needs to be marked - but I am trying to blame Adobe because their syntax is confusing.0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 799 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