Skip to content

A straightforward library for rendering TrueType and OpenType fonts in MonoGame.

License

Notifications You must be signed in to change notification settings

SometimesRain/SimpleMonogameTruetype

Repository files navigation

2019/07/17: Obsoleted by MonogameDistanceFont which uses scalable signed distance fields instead of software rendering. Distance field fonts are more flexible and simpler to use.

A dead simple TrueType or OpenType runtime font renderer for MonoGame

Built on top of the excellent C library stb_truetype.

Usage

// Load font (accepts filename or system font name)
Font font = new Font("Arial");

// Generate bitmap data
BitmapData data = font.GenerateBitmapData("Hello, MonoGame!", 64);

// Create a texture and set its data
Texture2D fontTexture = new Texture2D(GraphicsDevice, data.Width, data.Height, false, SurfaceFormat.Alpha8);
fontTexture.SetData(data.Alphas);

Examples included

  • Rendering with SpriteBatch
  • Rendering with custom pixel shader
  • Resizable text field
  • Input field
  • Rendering without SpriteBatch

About

A straightforward library for rendering TrueType and OpenType fonts in MonoGame.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published