Skip to content

grimfang4/nfont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFont: A font class for SDL
by Jonathan Dearborn
[https://github.com/grimfang4/nfont]
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



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

Notes:
    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



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

About

A powerful font class for SDL and SDL_gpu.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published