This is essentially what we do for URL clicking behavior. It’s a pain, but AFAIK it’s the best option in JUCE.
In case you run into this: underlining stopped working on for memory fonts on macOS recently: Underlining has stopped working for TextLayout / AttributedString