frontpage

Links

Hybrid Graphics homepage
Our support forums

About font2openvg

font2openvg is a tool for extracting font outlines into a C format that can be easily used with OpenVG. The tool converts any font format FreeType2 can load into C source code that can be #included into your C program that wishes to use the path data.

font2openvg works on both Unix and Windows platforms. It is written in C++, and is linked against the FreeType2 library.

The software has been written by Jussi Räsänen. E-mail to jussi at hybrid dot fi if you want to contact the author.

License

This software is licensed under the very permissive BSD license.

Download

Source code

font2openvg.cpp

Prebuilt binaries

None available for now.

Install

Make sure your system has FreeType2 installed. We don't have any makefiles or project files for font2openvg available, so you have to create your own project or makefile that compiles font2openvg.cpp and links it against the FreeType2 library.

Converting and using converted content

Here's how to convert and use a font file:

  1. Convert a font file into a .inl file (C format). The array names will be prefixed by a name of your choice (here myarial) so that it's easy to include multiple font files into your application.
    $ font2openvg arial.ttf arial.inl myarial
    
  2. #include the .inl file into some C file that wishes to use the converted path data
    /* Include the data, symbols will be prefixed with 'myarial' */
    #include "arial.inl"
    
    
  3. Render the object using OpenVG calls. Here's a small class that does the trick for you: renderFont.h renderFont.cpp

Command line options

Syntax

font2openvg input_font_file output.inl prefix

Options

input_font_file Any font file FreeType2 is able to load
output.inl Output C file that contains the path data
prefix A string that is used as a prefix for all the path data arrays so that unique names can be generated for each font file you want to use in an application. In order to produce code that compiles, don't use spaces or any characters C doesn't allow for identifiers.