RUfl is the RISC OS Unicode font library. It provides a high-level interface to rendering and measuring Unicode text. RUfl was developed to enable NetSurf to handle Unicode text on RISC OS. It is available for use in other applications.
RUfl simplifies the task of making best use of the underlying font manager and provides functionality that the font manager does not. Applications (such as NetSurf) just feed RUfl with UTF-8 encoded text and RUfl does the rest for them.
If the underlying font manager is Unicode capable, then RUfl will plot the text using the selected font. If a particular glyph does not exist in the selected font, then it looks up a substitute font that does contain the glyph and uses that. If no fonts on the system contain the glyph, a Unicode codepoint is plotted in place of the glyph.
When running on a non-Unicode font manager, RUfl checks whether the selected font contains the glyph, and if it does, which font encoding contains it. It then converts to an 8 bit character code and plots the text using the encoding found. This enables applications to make full use of fonts, such as Homerton and Trinity, that contain additional glyphs in other encodings. If the font did not contain a particular glyph, it looks for another font that does. If it finds one, it does the same encoding lookup and plots it accordingly. If no fonts on the system contain the glyph, a Unicode codepoint is plotted in place of the glyph.
RUfl manages to do all this efficiently by maintaining cached lookup tables containing various mappings.
You can browse the source code via the online interface. Alternatively, you can check it out with Git:
$ git clone git://git.netsurf-browser.org/rufl.git
RUfl is licensed under the MIT Licence.
Please report any problems with this library to the developer mailing list.