libhersheyfont(3) Hershey vector fonts library


#include <hersheyfont.h>

struct hershey_font *hershey_font_load(const char *fontname);
struct hershey_font *hershey_jhf_font_load(const char *jhffile);

struct hershey_glyph *hershey_font_glyph(struct hershey_font *hf, unsigned char c);

void hershey_font_free(struct hershey_font *hf);


The Hershey fonts are a collection of vector fonts developed circa 1967 by Dr. A. V. Hershey. libhersheyfont provides C routines to load and process .jhf format Hershey font files.

A Hershey font may be loaded with herhsey_font_load() or herhsey_font_jhf_load(), either of which returns a pointer to a newly allocated struct hershey_font. This structure should be freed after use with a call to herhsey_font_free().

The glyph line segment data for each ASCII character may be accessed with herhsey_font_glyph().

See the hersheyfont.h header file for the details of the structure members.


hershey_font_load()'s fontname parameter must be the name of a system-installed Hershey font. The Hershey fonts likely to be installed are:

astrology, cursive, cyrillic, futural, futuram, gothgbt, gothgrt, gothiceng, gothicger, gothicita, gothitt, greekc, greek, greeks, japanese, markers, mathlow, mathupp, meteorology, music, rowmand, rowmans, rowmant, scriptc, scripts, symbolic, timesg, timesib, timesi, timesrb, timesr

herhsey_font_jhf_load()'s jhffile parameter must be the filename of a Hershey font .jhf file.


The directory in which herhsey_font_load() expects to find .jhf font files (The default directory is likely /usr/share/hershey-fonts/ or /usr/local/share/hershey-fonts/ depending on the build configuration).


See hershey-font-example.c for a complete working example program, including code to parse the glyph data. Likely location:



libhersheyfont was written by Kamal Mostafa <[email protected]>.