Is it possible to hide everything beyond a glyph's canvas?

I’m trying to resolve the problem of underline’s appearance on the web — browsers and apps often mess up underline’s thickness or/and position. I need it for a design identity based on an underline.

In order to resolve the problem, I want to create a font feature with every glyph having a line under it. It seems that a smart component could help — however, I would still have to manually change the width of the line for every glyph. So I was hoping for a simpler solution like just inserting a wide underline into every glyph and automatically cutting it to the glyphs’ widths.

In short, I need a fast way to make hundreds of instances of a component to match the glyphs’ widths.

I hope that I make sense