Flipping alternates
Nick Shinn
Posts: 2,208
I can’t figure out how to code this the way I’d like to.
Suggestions would be welcome!
The premise of the font is to alternate characters between roman and italic.
The basic code is very simple.
@default = roman glyphs
@alts = italic glyphs (e.g. A.alt etc.)
Inserting a space before the sentence produces another option for the user:
However, I’m not happy that the letters on either side of the space have the same inclination.
It occurs to me that alternating the slant across the word space would be better.
This I achieve by adding a line of code at the beginning, to put two characters between words:
But his means that when the user inserts a space at the beginning, it becomes two characters and will thus not produce the optional look, merely moving the image to the right. A period or any other single character would do the job:
I would rather that the user achieve this effect by inserting a space—but how?
Is there some method involving “ignore” or lookups?
Or some other method entirely?
Any ideas?
Suggestions would be welcome!
The premise of the font is to alternate characters between roman and italic.
The basic code is very simple.
@default = roman glyphs
@alts = italic glyphs (e.g. A.alt etc.)
sub @default @alts' by @italics;The result:
Inserting a space before the sentence produces another option for the user:
However, I’m not happy that the letters on either side of the space have the same inclination.
It occurs to me that alternating the slant across the word space would be better.
This I achieve by adding a line of code at the beginning, to put two characters between words:
sub space by space.half space.half;
But his means that when the user inserts a space at the beginning, it becomes two characters and will thus not produce the optional look, merely moving the image to the right. A period or any other single character would do the job:
I would rather that the user achieve this effect by inserting a space—but how?
Is there some method involving “ignore” or lookups?
Or some other method entirely?
Any ideas?
0
Comments
-
There are a few ways you could handle this as you describe, but I am questioning the notion of using insertion of a space to trigger the optional behaviour. Ideally, affecting the appearance of text should not involve changing the context of the text. Why not make the starts-on-italic option a stylistic set feature? In any case, you will need to sort out the first-glyph-in-run using a negative context, i.e. sub roman by italic if not preceded by any other glyph.
So you want to continue with the concept of using a preceding space to trigger the optional behaviour, you can perhaps add contextual code to your two-half-space substitutions that disables it when not preceded by any other glyph? [Sorry, I can’t remember how to do this in AFDKO syntax.]
1 -
I’m putting this in the <rlig> feature, so “double spacing” won’t affect the underlying text.(<rlig> maintains the effect when substantially tracked, whereas the more normal <calt> and <liga> do not.)I’d rather not use a stylistic set for the optional appearance.I have tried negative context, but couldn’t get it to work—hence my post!I’m not tied to the double-spacing method, if there is a better way…I’ve used negative context for initial swash capitals, but here only want to enable the effect at the beginning of a sentence, not at the beginning of every word as well.0
-
0
-
Nick Shinn said:
However, I’m not happy that the letters on either side of the space have the same inclination.
@default = roman glyphs@alts = italic glyphs (e.g. A.alt etc.)@spaces = space (emspace hyphen etc.)sub @default @spaces @alts' by @italics;
sub @default @alts' by @italics;
0 -
If you want them to alternate, but with arbitrary ignored glyphs in the middle, then (and this is completely over-engineering it) give the glyphs that you want to ignore the "ligature" category in the GDEF table, and set the "IgnoreLigatures" lookup flag.2
-
I’m putting this in the <rlig> feature, so “double spacing” won’t affect the underlying text.I was referring to insertion of space at the beginning of a run to affect the variant behaviour.
0 -
Thanks for the advice everybody! I will take another crack at it and report back in a while (but not immediately, I’m busy with many things at the moment).0
-
0
-
The feature code would be
lookupflag IgnoreLigatures;
sub @default @alts' by @italics;
but to make it work you would need to set the GDEF categories. If you are using Glyphs, select all the glyphs you want to be ignored (space, punctuation, etc.), press command-option-I (or Edit menu > Info for selection), and click on the check boxes next to Category and Subcategory, filling in the information like this:1 -
Grzegorz Luk (gluk) said:Nick Shinn said:
However, I’m not happy that the letters on either side of the space have the same inclination.
0 -
Thanks again Grzegorz, Simon, John, Michael.
I’ve actually opted for “none of the above”, and will make two separate fonts, one which starts with roman, the other with italic.
The impetus was John’s comment about the insertion of a space at the beginning, which messes up layouts.
I’ve never considered this two-font method in my previous, pseudo-random typefaces (Fontesque, Duffy, Neology), perhaps because they all have large-ish families and duplicating them would create menu clutter, and I’ve always used the “add space at beginning” method in cycling through the alternates in prototyping such designs.
However, rather than burying the option in a Stylistic Set, having a separate “B” font up front in a layout app menu makes sense here.2 -
For fun and tests I made version with StylisticSet, however, if you insist on a solution with a space at the beginning you can achieve this simply by (avoiding space.half and using ignore):lookup caltflip {
lookupflag 0;
ignore sub [ A.alt B.alt C.alt ... a.alt b.alt c.alt ] [ space ] [A B C ... a b c ... ]' ;
sub [space exclam quotedbl numbersign ... A B C ... a b c ... ] [A B C ... a b c ... ]' by [A.alt B.alt C.alt ... a.alt b.alt c.alt ...];
} caltflip;Unfortunately, version with ignore work properly on Firefox, Safari, Inkscape.. and not on Chrome.Working demo with both fonts HERE0
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