Quantcast
Channel: TypeDrawers
Viewing all articles
Browse latest Browse all 4153

Replacement lookup

$
0
0
I would like to implement a replacement lookup in a font instead of relying on the software. I explain the thing from the software point of view, since I am more expert in LaTeX than in fonts. The relevant part of code is as follows:

\directlua{

   fonts.handlers.otf.addfeature{
    name = "apo-nosc",
    type = "chainsubstitution",
    lookups = {
      {
        type = "substitution",
        data = {
          ["quoteright.sc"] = "quoteright.fr", 
        },
      },
    },
    data = {
      rules = {
        {
          before  = { { "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"} },
          current = { { "quoteright.sc" } },
          lookups = { 1 },
        },
      },
    },
  }
}
When I write, for example, < \textsc{l'albero L'Albero} >, the first apostrophe is correctly rendered with the low apostrophe, that is with quoteright.sc. In the second case, the replacement rule for Luatex that I set replaces quoteright.sc with the high apostrophe, that is quoteright because the apostrophe is still between two capitals:



Is it possible to create a similar rule within the font that makes additional code in the text unnecessary?
And what should I adopt? A Contextual or Chaining Contextual Substitution?
Thank you

Viewing all articles
Browse latest Browse all 4153

Trending Articles