Lookups. Why do I need them ?

docunagi's picture

Ok… I am a little bit lost here with the lookups in Opentype fonts. Anyone could tell me the interest there is to add lookup if I already made a -salt- feature (for example) with my classes ?
For example I have this feature :

feature salt {
sub @reg_lc by @alt_lc ;
sub @reg_uc by @alt_uc ;
sub @reg_sc by @alt_sc ;
} salt;

Why would I need to add lookups and what way would they improve my font ? I don't really get the big interest there is behind lookups. Could anyone explain it with more simple words than the Fontlab manual :)

frankrolf's picture

You can make use of a lookup later in your feature file, in order to avoid repeating the feature code.
(For instance, you might want the same substitution to be active in multiple different language systems. First, you wrap the feature code in the lookup; later, you just call the lookup again.).


Stephen Rapp's picture

Lookups are also useful for isolating more complex contextual substitutions. I've always used them for beginning and ending substitutions: Scroll down to Karsten's post:

docunagi's picture

Ok thanks. It is a little bit clearer. But I need to include lookups in case I have some issues with complex situations. If I have some basics alternate characters to replace and if my salt feature do the job fine, do I really need to add it ? I mean I can live without it (if my fonts features works fine), right ?

frankrolf's picture

Yes, the font will also work just fine without lookups.

Khaled Hosny's picture

The feature file compiler will take care of building lookups behind the scene, I think allowing defining features without lookups is merely syntactic sugar.

docunagi's picture

Ok thanks for all the precious infos ! And the prompt answers.

frankrolf's picture

A thing I forgot to mention:
Lookups will go and jump back to the beginning of a line before doing their job.
Consequently, by including a handful of lookups, you can actually make more complex substitutions happen than would be possible with a single-glyph treatment.

docunagi's picture

That is what I understood. But as my font is only replace this glyph by this glyph without any contextual swapping, I'll dig into lookups when I really need it :D

twardoch's picture

I've tried to explain what lookups are and how they are used here:


docunagi's picture

great thanks adam.

Syndicate content Syndicate content