---
name: "hershey_font_load"
section: "3"
platform: "linux"
package: "libhersheyfont-dev"
version: "0.1-1.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libhersheyfont"
---

# hershey\_font\_load(3)

Hershey vector fonts library

Part of [libhersheyfont(3)](/libhersheyfont/3.md).

## NAME

libhersheyfont - Hershey vector fonts library

## SYNOPSIS

**#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***);**

## DESCRIPTION

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.

## FONTS

**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.

## ENVIRONMENT VARIABLE

- **HERSHEY\_FONTS\_DIR**

  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).

## EXAMPLE

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

```
/usr/share/doc/libhersheyfont/examples/hershey-font-example.c
```

## AUTHOR

**libhersheyfont** was written by Kamal Mostafa \<kamal@whence.com\>.
