Opentype Contextual glyph replacement

ebensorkin's picture

Has anybody done this yet? Contextual replacement in OpenType using Kerning as the context.

I would like to offer a version of my font Army Pool Tiles ( which has kerning pairs ) in a reverse mode. Originally I thought I could just reverse the tiles but then I found I was getting unacceptable overlaps and gaps when the kerning was used ( suprise suprise) - so I need to create context dependent alternatives that fit correctly for the reverse font/s.

Has anybody here done this?

I am also just starting to learn this aspect of Fontlab. Does anybody have opinions about if it is better to code for contextual substitution in fontlab or with some 3rd part tool?

******
Update. I added an image which shows the kerning result. What the blue highlight is showing is the area I am concerned with in a reverse version of my font. In a reverse version the blue area would be mostly filled with tiles. When I apply a kern between the 'V' & 'a', the 'a' comes closer to the 'V'. Without substitution part of the V would be overlapped. What I plan to do is create an 'a' which has it's first line of tiles removed to substitute in when it occurs after 'V' (and some other glyphs). I have 298 pairs total.

If I get this working I will show the results.

AttachmentSize
example.jpg32.9 KB
Thomas Phinney's picture

The definition of "contextual" (as in 'clig' and 'calt') is that some glyphs, other than those being substituted, provide the context. There's no reason to use 'clig' when it's not contextual; you might as well use 'liga', 'dlig' or 'hlig' as appropriate.

You can of course use what's supported by current applications as a guiding factor as well. But beware that using inappropriate features will just confuse things later when future applications do implement the more "correct" features. Remember, fonts last almost forever.

Cheers,

T

Henyk's picture

Thanks, Tom!

But please answer on question: how to call hlig replacement in InDesign CS/CS2 manually? I don't see it in OT-menu...

twardoch's picture

Henyk,

InDesign does not support "hlig" but Mac OS X 10.4 Tiger does (so it works in TextEdit, Keynote, Pages and other Cocoa applications).

Adam

Thomas Phinney's picture

Actually, in InDesign turning on "discretionary ligatures" activates both the 'dlig' and 'hlig' OT layout feature tags.

T

dezcom's picture

Is there a way to globally use alternates? Let's assume you have an alternate "g" and want to use it in a column of text. Is there a way of doing this without using the Glyph palette a hundred times? What I do now is the the alternate as Swash and use the Swash feature in InD. It works but it is kind of false advertising sing the alternate g is not swash by any means.

ChrisL

ebensorkin's picture

You could always do the old fashioned thing and offer ant alt font...

What I want OTF to do is to let us specify color. It wouldn't be *that* hard surely!.

And it would open up a whole new market! Think of what you could do with overlays!

Henyk's picture

Czesc!

> but Mac OS X 10.4 Tiger does

But I'm working with WinXP-SP2, and haven't another way then InDesign now :)

Henyk's picture

> Actually, in InDesign turning on “discretionary ligatures” activates both the ‘dlig’ and ‘hlig’ OT layout feature tags.

Oh my, how complicated! ;)

Thanks, Tom.

paul d hunt's picture

> Actually, in InDesign turning on “discretionary ligatures” activates both the ‘dlig’ and ‘hlig’ OT layout feature tags.

but not in PhotoShop. Down with discrepancies!

Mark Simonson's picture

Is there a way to globally use alternates?

In InDesign, you can apply a stylistic set. There can be up to 20 of them.

Personally, I think the mechanism for choosing alternate characters in OT fonts is flawed and limited.

Let's say you always want to use a certain alternate "e" in a certain font.

You could insert it manually every time an "e" appears, but that would be extremely tedious.

Or, you see that the alternate "e" is part of Stylistic Set 2, so you select all the text and apply that. But then you notice that Stylistic Set 2 also contains a bunch of other alternates that you don't want. The only recourse is to apply the Stylistic set just wherever an "e" appears, but that's almost as tedious as the first method. (You get a similar problem when you put the alternates in a separate font.)

It seems like you ought to be able to look at a list of alternates for a particular character and set a preference for which one to use in a particular text selection or style sheet. This would be a sort of user-defined "stylistic set."

(Yet something else for Adobe's feature request page. Not that Adobe should be the only one listening.)

ebensorkin's picture

It does seem like setting preferences for use by the user - and being able to offer these preferences pre-set as part of the font design would be a far more practical addition. I agree. In the meantime, although it takes up more space than is ideal you can release several versions of a font with the features set that you think most likeley to be of use. Even if it's just 1 2 or 3 glyphs.

Mark Simonson's picture

Imagine, though, if you had a font with even just five alternate characters (corresponding to five normal characters). With five alternates, there are 31 possible stylistic sets using 1 to all 5 alternate characters. Add one more alternate character and you get 63 possible sets. Ad one more and you get 127, and so on. How do you decide which are the most likely combinations? What if the user wants some other combination? Having a UI in which the user can choose alternates à la carte and apply them to an entire range of text seems like it would be a less cumbersome approach.

paul d hunt's picture

Having a UI in which the user can choose alternates à la carte and apply them to an entire range of text seems like it would be a less cumbersome approach.

i agree. i think it would be great if there were some type of panel that let you basically build your own OT rules, something like stylesheets but actual user defined stylistic sets would be awesome.

ebensorkin's picture

Mark, I agree of course - I just meant that in some cases, not even the majority, it could make sense (and be practical) to have a regular & then an alt 1 set & maybe an alt 2 set where a few glyphs are changed either with OT script/feature or simply by using different outlines. Chris' new font to be being one possble case. His font has both a double bowl g & a single bowl g and it makes a big difference to how the face comes across. Given the change in feeling he perhaps cound redesign or tweak 2-3 other characters in a version of his font and create a different feeling. Like I said it is no panacea. But he could do it today without waiting for improvements to the OT standard.

Mark Simonson's picture

I just noticed something about InDesign's implementation of stylistic sets: You can apply more than one at a time. A type designer could put just one alternate character in each set, thereby getting the "à la carte" effect that I described. You would still be limited to 20 sets, but it would work if you had a limited number of alternates. If have more than 20 alternates, and there are certain alternates that, as a rule, should go together, you could put them in the same set to get them into the 20 available sets...

Mark Simonson's picture

In fact, I think this is such a great idea, I'm going to do an update to Proxima Nova. I wish I'd though of this before I released it.

(Free update for licensed users--you will be notified when it's ready.)

dezcom's picture

"...Given the change in feeling he perhaps could redesign or tweak 2-3 other characters in a version of his font and create a different feeling..."

The problem is also educating the user of how to do it and even letting them know it is available as a selling point.
I know you can get into rapid growth with the factorial of variables. Twenty factorial is a large number. Many font users don't even try the basic alternates. I guess we have to be satisfied we are at least offering many possibilities to the very type savvy designer.
I like the "Alternate style Sheet" idea. This would be a universal tool which would not have to be redefined for each and every typeface.

ChrisL

dezcom's picture

"(Free update for licensed users—you will be notified when it’s ready.)"

Thanks Mark!

Also, I'd be interested in how you do it. This seems like something of universal value to type designers.

ChrisL

Mark Simonson's picture

Note: You can apply one or more Stylistic Sets to a character- or paragraph-level style sheet in InDesign.

I will provide a user guide with Proxima Nova on how its Stylistic Sets work when the new version is out.

Mark Simonson's picture

What I intend to do is this:

There are four alternate characters in Proxima Nova: A more geometric (Futura-like) G, a one-story a (and corresponding two-story a in the italic), an l with a tail, and a curved y (similar to a one-story g). Note: The normal roman a is two-story; the normal italic a is one-story.

There will be seven stylistic sets:

Set 1: Alternate a, l, and y in the roman; Alternate l, and y in the italic. This is the "primer" or "schoolbook" set, intended for early reader books.

Set 2: Alternate G and a in the roman; Alternate G in the italic. This is the "Futura-like" set.

Set 3: Alternate G.

Set 4: Alternate (one-story) a (roman only).

Set 5: Alternate (two-story) a (italic only).

Set 6: Alternate l.

Set 7: Alternate y.

The first two are Stylistic Sets in the way (I think) the feature is intended to be used. The rest are effectively à la carte alternate character styles which can be mixed and matched to taste. You could actually recreate the first to sets using the others like this:

Equivalent to Set 1: Apply Set 4, Set 6, and Set 7.

Equivalent to Set 2: Apply Set 3 and Set 4.

And so on.

(By the way, the current version of Proxima Nova has two Stylistic Sets, basically the same as the first two of the proposed sets, except that the alternate (two-story) a is included in the italic. This was ill-conceived, I realize on hindsight.)

dezcom's picture

"By the way, the current version of Proxima Nova has two Stylistic Sets, basically the same as the first two of the proposed sets, except that the alternate (two-story) a is included in the italic. This was ill-conceived, I realize on hindsight.)"

Now I'll have to take another look it.

Thanks so much for sharing your wisdom on this Mark! I see I have much to learn about opentype features.

ChrisL

Mark Simonson's picture

InDesign CS2 was the first application (that I'm aware of) to support Stylistic Sets. I didn't have a copy of it until about a week before I released Proxima Nova, and didn't realize the program supported them until even later. Consequently, I put the features in before I really understood how they would be implemented on the user end.

I'm still learning, too.

k.l.'s picture

Mr Simonson --

but don't forget the manual! ;-)

Karsten

Mark Simonson's picture

http://www.kltf.de/downloads/KLTFTiptoeManual.pdf

I'm impressed! (Nice font, too.)

There was a time when even PostScript Type 1 fonts came with printed manuals and disks. Of course, the prices were quite a bit higher back then. (In 1986, for a three-weight font family like Goudy Oldstyle, Adobe charged $185--equivalent to $317 in 2005 dollars.)

dezcom's picture

Great idea Karsten!

ChrisL

hrant's picture

Wow, Karsten - impressive, on many counts.

hhp

k.l.'s picture

Oh thanks.

But it will turn out useful manuals really are. I doubt anyone will save fonts and manual together.

My first idea was to use ssXX features consistently throughout my typefaces, so, ss01 for certain substitutions, ss02 for certain others &c. But with the second and now third type it turns out the idea is unrealistic.
Now I read that a font's Description [in FL's FontInfo / Name ID 10 in the specifications] was also intended for feature descriptions which may be a nice idea. Then information are part of the font. Provided however that apps or font management tools would display these information ... But I haven't made use of this myself yet. Maybe you can do this for an updated Proxima Nova?

Karsten

ebensorkin's picture

Nice to see you on typophile Karsten!

Thomas Phinney's picture

I agree that Stylistic Sets are the best solution for the problem Chris proposes when he writes: "Is there a way to globally use alternates? Let’s assume you have an alternate “g” and want to use it in a column of text...."

Also, Stylistic Sets can perfectly legitimately be used much as Mark has suggested for Proxima Nova. The typeface I'm working on right now has quite a few of them, and in much this way. They can be mutually exclusive, or they can be mix-and-match.

Regards,

T

Mark Simonson's picture

Thomas, good to hear you say that. Part of me worried that my proposed use of Stylistic Sets was a sort of hack.

vizzie's picture

I've been reading through this interesting thread and have a question...

The book publisher I work for had this custom font developed years ago. It's a cursive font designed to teach children cursive writing. It's quite an amazing piece of work, each character has the ability to connect with the next character at either a high, middle, or low connector.

Originally the type 1 font was a 3-piece font: screen, printer, and some sort of executable that had to be downloaded to the postscript printer to control the contextual connections. This method caused 2 problems: 1) the font would sometimes get kicked out of the PostScript RIP if another font was downloaded, 2) You could not save to postscript for making PDFs.

Later this was all combined in to one font with built-in contextual intelligence. so that on postscript output from Quark Xpress (in OS 9) had all the processed contextual characters in place and PDFs could be made properly.

Well, we haven't used the font in awhile, have upgraded to OS X and InDesign and it occurred to a couple of us the other day that perhaps this special font will no longer work.

After a few tests we found that not only does it not work in OS X, but it only worked with QuarkXpress 4.11 in OS 9... Even a dusty copy of InDesign 2.02 in OS 9 would not work properly with the font.

Given all this back history, anyone have a clue as to how this font was made? We outsourced the original design of the font, so no one here knows how it was done.

At any rate, we have Font Lab on order and hopefully soon enough I'll be re-constructing the font in OpenType, and perhaps asking for hints along the way on this here messageboard...

Cheers,
/ed

dezcom's picture

You can create an Opentype font from it and it will work on all your Opentype savvy apps. Nick Shinn and Thomas Phinney gave a class at last years NYC TypeCon on exactly such a face.

ChrisL

vizzie's picture

Cool! Thanks for the info...

Will Font Lab be able to make the conversion? I was reading the Font Lab 5 user manual yesterday and it stated that Font Lab didn't support the positioning lookup required to get the connectors to connect each glyph.

there wouldn't happen to be any sort of archive of the class from the NYC TypeCon, a PDF or powerpoint presentation kicking around, would there?

Thanks again for getting back so quickly.

cheers,
/ed

Nick Shinn's picture

I don't think it would be a straightforward conversion, but it's unlikely you will need to use the positioning lookup.
You would probably have to examine the glyph sets, make them into classes, and learn how to implement the "Contextual Alternates" feature.
I figured out how to do it using the Fontlab manual.
Contact me and I will send you a reference PDF I made for the workshop.

paul d hunt's picture

Font Lab didn’t support the positioning lookup required to get the connectors to connect each glyph.

it’s unlikely you will need to use the positioning lookup.

Here you're looking for substitution lookups (not positioning lookups, which FontLab does support) that happen contextually. I recently did a connecting script using these types of lookups. I could post some code here if you're interested.

John Nolan's picture

Please, Paul, do share!

paul d hunt's picture

this may be able to be condensed somehow, but this works for letters that connect low and high (no middle connections).

OT Code:

feature calt {
lookup calt1 {
sub @lc_highexit @lc_all' by @lc_highentry;
} calt1;
lookup calt2 {
sub @bovw_default' by @bovw_natural;
} calt2;
} calt;

Classes:

@lc_highexit: b o v w b.high o.high v.high w.high
@lc_all: a b c d e f g h i j k l m n o p q r s t u v w x y z
@lc_highentry: a.high b.high c.high d.high e.high f.high g.high h.high i.high j.high k.high l.high m.high n.high o.high p.high q.high r.high s.high t.high u.high v.high w.high x.high y.high z.high
@bovw_default: b o v w
@bovw_natural: b.calt o.calt v.calt w.calt

just to explain a bit, if it doesn't all make sense on it's own: x.high is a lc character which has a high entry stroke, b.calt has a low entry stroke and a high exit stroke, b.high has high entry and exit strokes. This is an abbreviated chunk of code, leaving out diacritic forms (or else the class info would be much longer, but the OT coding would be the same). Critiques to this method are welcome.

ebensorkin's picture

Thank you Paul!

vizzie's picture

Thank you Paul!

We unearthed some more info on our special cursive font... it was actually a type1/type3 postscript hybrid.

and thank you for posting the code. I look forward to diving in to FontLab real soon.

cheers,
/ed

Syndicate content Syndicate content