the Fiddler's picture

OpenTK.Text

OpenTK.Text is a simple, cross-platform library that provides text drawing routines to OpenTK applications. It relies on GDI+ to provide native-quality 2d text that is suitable for user interfaces and debugging overlays. Can be used with OpenGL 1.x, 2.x and backwards-compatible 3.x contexts.

This project is in need of a maintainer.

Usage:

using System.Drawing;
using OpenTK.Graphics;
 
Font font = new Font(FontFamily.GenericSansSerif, 18.0f);
TextPrinter printer = new TextPrinter(TextQuality.High);
 
printer.Begin();
printer.Print("Hello, World!", font, Color.White);
printer.End();

Known limitations:

  1. The caching mechanism cannot deal with dynamic text. Specify TextPrinterOptions.NoCache when drawing text strings that change per frame.
  2. Mono GDI+ suffers from a large number of layout bugs. Workarounds are implemented for a number of those bugs, but unfortunately the workarounds allocate memory and may reduce performance.
  3. Only pixel-perfect, 2d text is supported. Trying to apply any perspective transform will probably cause the text to become illegible.

Releases