Along the lines of investigating portable C GUI libraries, I started looking at cross-platform library options for font rendering in C. This area is particularly useful if you're investigating creating your own GUI library or game library. I was most interested in the TrueType font rendering libraries and techniques. It was rather surprising to read just how difficult it is to get simple internationalized text to the screen especially using graphics libraries like OpenGL.

Here's what I've located. If you have other recommendations for C font rendering libraries, please let me know.


GUI library options like nuklear and nanovg use stb_truetype.h:
https://github.com/nothings/stb
They also use some kind of font stash, such as this one used with nanovg:
https://github.com/memononen/fontstash


Other GUI libraries use FreeType2.
https://www.freetype.org/

For instance, SDL2_ttf uses FreeType2.
https://www.libsdl.org/projects/SDL_ttf/

Allegro also has font libraries available that are based on FreeType2.
http://opensnc.sourceforge.net/alfont/mirror/

Here's one that works with Allegro or SDL:
http://kirill-kryukov.com/glyph-keeper/files.shtml


There are several font libraries for OpenGL, but there aren't many options written in C. Some are for older versions of OpenGL and some only work with later versions. Here's what I found so far:

https://github.com/rougier/freetype-gl
https://github.com/jtsiomb/libdrawtext
http://quesoglc.sourceforge.net/


Here's another C option that works with FreeType2 and embeds fonts in C programs:
https://github.com/chrisy/fontem


The most recommended technique used by OpenGL developers seems to be texture mapping. A texture can be used like a hash table to store various characters and other pixmaps that need to be rendered. An OpenGL function can draw a piece of the texture or update/change parts of it in memory without affecting performance too much. While software renderers have no real trouble copying or blending a bitmap graphic or pixmap, the newer OpenGL versions send the textures to the GPU for rendering. So utilizing a texture instead of bitmaps/pixmaps and minimizing the number of textures one is working with can improve performance.

I personally find it easier to render text with SDL. It handles copying and blending bitmaps (as an SDL_Surface) and offers a useful library (SDL_ttf) to do most of the work. SDL 2.x does use OpenGL underneath on some platforms, so some of the texture concepts used by OpenGL programmers might improve font rendering performance on some versions of SDL as well.

Freetype seems to be the library for working with TrueType fonts. SDL_ttf uses freetype to interpret the Truetype font format and create bitmaps/pixmaps to represent characters (converting them from vector format to bitmap/pixmap format). I found working with SDL_ttf a lot more user-friendly than trying to use Freetype directly.

Another viable option is stb_truetype.h. The license for this software is definitely an advantage. However, from what I've read the rendering still isn't quite as good as Freetype. I look forward to testing this out on my own at some point.

At this point, I'm still investigating SDL_ttf, stb_truetype.h and OpenGL texture mapping. A combination of these might be just what's needed in a font rendering design for a cross-platform GUI library.

Know of some other font rendering options that work well for Truetype fonts or have a better way to get fonts to the screen, I'd love to hear about it?
This is a list of mono-spaced fonts, Unicode fonts, font resources in general and useful FLOSS font sites.

Monospaced fonts are particularly useful for programming. They can help improve readability. Some programming editors (like PFE) only work with monospaced fonts. Other editors allow the use of more varied fonts. However, monospaced fonts are useful when working with PRE tags in HTML, ASCII art and in other areas.

Other useful fonts include Unicode fonts for internationalized projects and fonts for people with handicaps or disabilities such as fonts designed for people with dyslexia.

Using a Free, Libre or Open Source font or a public domain or Creative Commons licensed font makes it easy to reuse fonts in Open Source (or even commercial) projects.


Bitmap Fonts

woafon
Fonts for DOS and Windows Command Prompts
http://www.resoo.org/docs/dos/free_software/windos.htm


Free Monospaced Fonts (Bitmap)

Dina Programming Font
http://www.donationcoder.com/Software/Jibz/Dina

efont
Electronic Font Open Laboratory
http://openlab.ring.gr.jp/efont/index.html.en

Envy Code A
https://damieng.com/typography/envy-code-a

Envy Code B
https://damieng.com/typography/envy-code-b

Gohufont
http://font.gohu.org/

Liberation Fonts
https://fedorahosted.org/liberation-fonts/

MonteCarlo
http://www.bok.net/MonteCarlo/

Profont
MIT license
http://tobiasjung.name/profont/
https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/ProFont

Proggy Fonts
http://www.proggyfonts.net/

Raize font
http://web.archive.org/web/20180627152019/http://www.raize.com/DevTools/Tools/RzFont.asp
https://github.com/Tecate/bitmap-fonts

Sans Forgetica
https://en.wikipedia.org/wiki/Sans_forgetica

Tamsyn
http://www.fial.com/~scott/tamsyn-font/

Terminus font
Includes a large size font especially useful for terminals in framebuffer mode on Linux systems.
http://terminus-font.sourceforge.net/

Triskweline
http://www.netalive.org/tinkering/triskweline/


Free Truetype Monospaced Fonts

Adobe Fonts
https://github.com/adobe-fonts

Andika
http://software.sil.org/andika/

Bitstream Vera
https://download.gnome.org/sources/ttf-bitstream-vera/

Crystal
Available with Povray software.
https://github.com/POV-Ray/povray/tree/master/distribution/include
http://www.povray.org/povlegal.html

Cutive Mono
https://github.com/vernnobile/CutiveFont

DejaVu Fonts
https://dejavu-fonts.github.io/

Droid Sans Mono
http://damieng.com/blog/2007/11/14/droid-sans-mono-great-coding-font

Envy Code R
https://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released

Font Squirrel Monospaced fonts
http://www.fontsquirrel.com/fonts/list/find_fonts?filter%5Bclassification%5D=monospaced&filter%5Bfamily_size%5D=1&filter%5Bdownload%5D=all&sort=a2z

GNU FreeFont
Freemono
https://www.gnu.org/software/freefont/

GNU Unifont
http://unifoundry.com/unifont.html

Inconsolata
http://www.levien.com/type/myfonts/inconsolata.html

Junicode
Unicode font for medievalists
http://junicode.sourceforge.net/

Lucida Sans Typewriter Regular - included with Oracle's Java SDK
http://docs.oracle.com/javase/7/docs/technotes/guides/intl/font.html

Matthew Welch's MIT licensed fonts
White Rabbit worked as a monospaced font
http://www.squaregear.net/fonts/

MonteCarlo
http://www.bok.net/MonteCarlo/

Overpass
https://github.com/RedHatOfficial/Overpass

Oxygen Monospace
Oxygen Fonts
https://github.com/vernnobile/oxygenFont

ParaType
PT Mono
http://www.paratype.com/public/

Roboto Mono
Google's Roboto fonts
https://github.com/google/roboto/

SIL Encore Fonts
Several unicode fonts including some monospaced ones.
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=SILEncoreFonts

Source Code Pro
Adobe Font
http://adobe-fonts.github.io/source-code-pro/
https://github.com/adobe-fonts/source-code-pro

Space Mono
https://www.1001freefonts.com/space-mono.font

String Literal
https://www.fonts4free.net/string-literal-font.html

Ubuntu Fonts
Ubuntu Mono
http://font.ubuntu.com/

Xerox Alto mono-spaced font
http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released

Hack font
https://sourcefoundry.org/hack/

Hacked fonts
https://github.com/organicplanning/hackedfonts


Other Fonts

EB Garamond
http://www.georgduffner.at/ebgaramond/index.html

e-foundry
http://www.gust.org.pl/projects/e-foundry

et-book
https://github.com/edwardtufte/et-book

Lato Fonts
http://www.latofonts.com/

Libertine Open Fonts Project
http://libertine-fonts.org/

Monocraft
https://github.com/IdreesInc/Monocraft

MPH 2B Damase Font
http://www.wazu.jp/gallery/views/View_MPH2BDamase.html

Proza-Libre
https://github.com/jasperdewaard/Proza-Libre

Simon Tatham's Fonts Page
http://www.chiark.greenend.org.uk/~sgtatham/fonts/

Sorts Mill fonts
https://bitbucket.org/sortsmill/sortsmill-fonts

UnB
http://www.marca.unb.br/fontesunb.php


Font Related Links

Codeface
Several monospaced fonts (TrueType, bitmap, OpenType) for developers.
https://github.com/chrissimpkins/codeface

Cufon Type Converter
Convert TTF fonts to cufon font format for web sites. With a few text changes, fonts can be used with Raphael.js too.
http://cufon.shoqolate.com/generate/

FontForge
Create your own fonts.
http://fontforge.github.io/en-US/
Example fonts in sfd format including Monospace, Caslon and Caliban:
https://fontforge.org/archive/sfds/

Font Library
https://fontlibrary.org/en/terms
https://fontlibrary.org/en/guidebook/existing_libre_open_fonts

Font Squirrel
Handpicked Free Fonts
http://www.fontsquirrel.com/

Google Fonts
https://fonts.google.com/

Monospace/Fixed Width Programmer's Fonts
http://lowing.org/fonts/

OpenDyslexic
http://opendyslexic.org/

SIL Open Font License (OFL)
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL

Wikipedia Open Source Unicode Typefaces
https://en.wikipedia.org/wiki/Open-source_Unicode_typefaces

Unicode Font Guide For Free/Libre Open Source Operating Systems
http://www.unifont.org/fontguide/

April 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27282930   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 24th, 2025 09:35 am
Powered by Dreamwidth Studios