A powerful font class for SDL and SDL_gpu.
C++ C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
NFont Updated version info. Aug 13, 2016
SDL_FontCache @ 471c1a4


NFont: A font class for SDL
by Jonathan Dearborn
Dedicated to the memory of Florian Hufsky

NFont is a C++ library that makes it easy to add bitmap or TrueType fonts to your programs.  Using SDL_gpu or SDL_Renderer, NFont can load and display bitmap text.  Using SDL_ttf, you can load TrueType font files.

Cool features:
 * Multiline (\n) rendering
 * Text alignment (left, center, right)
 * Boxed drawing
 * Text position animations
 * Unicode (UTF-8) support
 * Coloring and scaling
 * Permissive license

    SDL ("SDL.h") [www.libsdl.org]
    SDL_ttf ("SDL_ttf.h") [www.libsdl.org]
    SDL_gpu ("SDL_gpu.h") [https://github.com/grimfang4/sdl-gpu]

    NFont is a font class with text-block alignment, full
    support for the newline character ('\n'), position animation,
    and UTF-8 support.
	There are two versions of NFont.  NFont uses SDL 2.0's built-in SDL_Renderer API by default.  If you want to use the SDL_gpu rendering path, then #define FC_USE_SDL_GPU project-wide.  This will affect both SDL_FontCache (the core of NFont's caching system) and NFont itself.
    NFont natively loads and caches TrueType fonts with SDL_ttf via SDL_FontCache.  If you use SDL_Renderer, SDL version 2.0.4 is the first version to fully support clipping (e.g. for NFont::drawBox()).

    If you come up with something cool using NFont, I'd love to hear about it.
    Any comments can be sent to GrimFang4 [at] gmail [dot] com

	NFont is licensed to you under the terms of the liberal MIT license.  See NFont.h for further information.