3 Replies Latest reply on Oct 14, 2003 12:57 PM by (Adam_Twardoch)

    Separating lookups from feature definitions in FEA files -- possible?

      Dear AFDKO developers,

      is it possible to draft a list of lookups outside of the context of feature definitions (just like you do with glyph classes) and only include references to the lookups within the feature definitions? Something like the code below.

      I'd like to use FDK rather than VOLT to build my font but would like to have precise control over the ordering of the lookups. Currently, only VOLT gives me this ability: I build my lookups separately and assign them to features later.

      If this is not possible currently, please count this as a feature request for AFDKO.

      Adam

      -- Example --

      lookup liga_with_i {
      sub f f i by ffi;
      sub f i by fi;
      } liga_with_i;

      lookup liga_no_i {
      sub f f l by ffl;
      sub f f by ff;
      sub f l by fl;
      } liga_no_i;

      feature liga {
      script latn;
      language dflt;
      lookup liga_with_i;
      lookup liga_no_i;
      language TRK exclude_dflt;
      lookup liga_no_i;
      } liga;
        • 1. Re: Separating lookups from feature definitions in FEA files -- possible?
          Level 1
          I'm just reading in the AFDKO docs: "The lookup block must be specified within a feature block and may not contain any other kind of block. " -- so I guess the answer to my question is "no". This is a pity. Maybe you could extend the AFDKO notation to include something like a "lookups" block where all the named lookups could be included. Then, the code could look like:

          lookups {
          lookup liga_with_i {
          sub f f i by ffi;
          sub f i by fi;
          } liga_with_i;
          lookup liga_no_i {
          sub f f l by ffl;
          sub f f by ff;
          sub f l by fl;
          } liga_no_i;
          } lookups;

          feature liga {
          script latn;
          language dflt;
          lookup liga_with_i;
          lookup liga_no_i;
          language TRK exclude_dflt;
          lookup liga_no_i;
          } liga;

          This would greatly help developing large feature sets that share code.

          Adam
          • 2. Re: Separating lookups from feature definitions in FEA files -- possible?
            Level 1
            This is a good idea, and easy to implement.  I will implement it when I mext get to work on makeOTF, which will be in about a month, barring further interruptions,. ie. don't count on it before next spring.<br /><br />In the short-term, you could achieve the effect by defining your lookups in a dummy feature. This is ugly in that your font would contain a feature that  was not meant for use. However, the overhead of storing the extra feature is very small, under 100 bytes.<br /><br />This is similar to what I would do in the code. I would define a new keyword "lookups" that would simply translate internally to " feature <dummy tag>,   and the I would omit this dummy tag from the Script/Language/FeatureList tables, so that only the lookups would be written to the font file.
            • 3. Re: Separating lookups from feature definitions in FEA files -- possible?
              Level 1
              This is excellent news -- thank you Read!

              Since FEA is basically a simple programming language, this really is "functional programming". In some cases, it makes sense to put all your detail definitions in a separate block, or a header, or an include file, and use them freely inside your implementation without having to worry about the details. Of course, in many project, the way it currently works is fine, but is some more complicated stuff, separating the lookups from the features would be useful.

              It would also be very useful when porting OTL code between VOLT, FDK and other technologies: VOLT stores lookups and features separately, which is useful in more complicated projects.

              Adam