Client side, using a browser extension or accessibility features to overlay the ruby could be a lot easier and probably more efficient.
That way choosing a powerful and more accurate engine, or more adapted display of the characters also becomes an option.