Hi,

as Hans recommended in the last video meeting, I tried to implement
the texquotes feature using OTF features, and hit two problems:

1) To support German quotes as well, I have two ligatures that end
   up as the same glyph:
      `` -> “
      "' -> “
   This can't be in the same ligature feature, as it will overwrite
   the table entry with a duplicate key.

   After some fiddling, I decided to map "' to a Unicode PUA symbol
   and then add a second feature that maps this symbol to “ using
   the substitute feature.  This works for TeX Gyre Schola.
   But perhaps someone knows a nicer way.

2) This approach doesn't work for lmodern or palatino, I still
   get "' as inch-sign/quote there... anything else I need to tweak
   for these fonts?


\startluacode
    fonts.handlers.otf.addfeature {
        name = "texlig",
        type = "ligature",
        data = {
            ['“'] = { "`", "`" },
            ['”'] = { "'", "'" },
            ['„'] = { '"', "`" },
            [''] = { '"', "'" },
            ['‘'] = { "`" },
            ['’'] = { "'" }
        }
    }
    fonts.handlers.otf.addfeature {
        name = "texsub",
        type = "substitute",
        data = {
            [''] = '“',
        }
    }
\stopluacode

% with lmodern or palatino it breaks
\setupbodyfont[schola]

\definefontfeature[ltest][texlig=yes,texsub=yes,trep=no]
\addff{ltest}

\starttext

``foo'' `foo' "`foo"' 19" rack

\stoptext


Thanks,
-- 
Leah Neukirchen  <l...@vuxu.org>  https://leahneukirchen.org/
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to