How to build a swash/ligature glyph so it extends the entire line of text

Is it possible to build, for example, an “L” so it automatically underlines the word that is typed?

In this case, it might be easier to have alternate glyphs with an underline that are contextually replaced (and together look like a line “L”). Otherwise you need a LOT alternate “L” and a lot contextual code.

There may be two problems:

  • the word spaces may not work in every environment
  • minor rendering issues where the underlines click

The code could look something like this:

lookup underliningLatBeginning {
   ignore sub @AllLetters L';
   sub L' by L.initUnderline;
} underliningLatBeginning;

sub L.initUnderline @WithoutUnderline' by @Underline;
sub @Underline @WithoutUnderline' by @Underline;

The class @AllLetters can be automated, but you would have to create yourself (and keep in sync) the classes @WithoutUnderline and @Underline.

Thank you!