Hershey Text v 3.0

Some years ago we wrote a neat little Inkscape extension called Hershey Text. Hershey text could take a little bit of text that you would type and render it into stroke fonts, also known as engraving fonts.

We are very pleased this week to release an all-new version of Hershey Text, written from scratch, and far more useful, capable, and extensible. We have a comprehensive user guide for it as well.

Hershey Text v 3.0 will be bundled into future versions of Inkscape, but it’s also included with the new AxiDraw software and available on its own for download today.

A little background

All common computer font formats (TrueType, et al.) are outline font formats. In these, each glyph in the font defines a filled vector shape. That is to say, the visible part of a character in an outline font is the area enclosed by the shape. Fonts like these are appropriate for use in laser printers or other high-resolution devices.

By contrast, an engraving font (sometimes called a “stroke” font) is one where each visible character is defined by the stroke itself, not the area enclosed by it. Fonts like these are usually the best choice for pen plotters, machine tools, and other circumstances where the pen width itself is significant.

Old vs new

The original Hershey Text worked quite well, but was limited in scope. The mechanism for drawing fonts was based on a historic font format that turned out to be quite limiting:

  • As a “custom” (neither proprietary nor standard) font format, there was no readily available font editor that could be used.
  • The font format only supported characters made of straight line segments.
  • The font data was encoded by ASCII character position, and did not support basic international (Latin-1) characters, let alone Unicode.
  • All of the font data was stored in a single large file. This made adding new fonts (even with data available) extremely cumbersome.

Additionally, the function of the original Hershey Text was relatively simplistic: It rendered text that you entered in the text entry box. This left no facility for rendering paragraphs of text, nor for easily working with multiple fonts, sizes, or styles.

Hershey Text v 3.0 aims to resolve all of these issues.

SVG Fonts

First, the new version uses the SVG font format. While this is not a common font format [1], it is a standard, and that fact makes it possible to create and add new fonts with relative ease.  Characters (glyphs) within an SVG font are composed of little SVG drawings, which (in contrast to almost every other modern font format) can natively support stroke fonts.

Migrating to SVG fonts immediately gets us support for font editors, arbitrary shapes within fonts  (not just straight segments), international character and Unicode support, and separate files for the fonts — making it practical to add new fonts. One company is already making new handwriting fonts compatible with the new format.


Replacing text in place

The second major change is that instead of entering text (one line at a time) in the dialog box, the new Hershey Text now converts text in the document, replacing it in place. This brings support for not just paragraphs of text, but also for handling mixed text with different sizes and styles, in whatever way it is laid out on a page.


Automatic font substitution

As an advanced feature, the new Hershey Text supports a subtle means of text substitution. If you have text laid out in a regular (outline) font but also have a stroke font matching the same name as that outline font, then it will automatically use that particular stroke font when Hershey Text is called. This feature makes it possible to preview how text will be laid out in a matching outline font, and also to automatically render into multiple stroke fonts within the same document.


Getting Hershey Text v 3.0

Hershey Text v 3.0 will be included with the forthcoming Inkscape 1.0, which is headed for release later this year. We also have a version for Inkscape 0.92.x, ready for use today.

Hershey Text v 3.0 is now included standard with both the AxiDraw software installers and the EggBot software installers.


You can find current instructions for downloading and installing Hershey Text at our documentation wiki.

Additionally, the PDF Hershey Text user guide is available for download at our documentation wiki. We encourage all users to read through this guide to learn more about how the software works.


Hershey Text v 3.0 is open source software; development and our issue tracker are hosted at gitlab.


[1] The SVG font format — as a stand-alone font format — is essentially obsolete. More or less, no one is using stand-alone SVG fonts. However, SVG fonts are perhaps surprisingly alive, thanks to emoji. The SVG font format has actually been enshrined within OpenType, and OpenType fonts can contain an “SVG font table”, which is simply a font constructed according to the SVG 1.1 font format. Fonts of this spec are called “OTF+SVG” fonts, and typically intend that when client software cannot display a given character in the SVG table, it will fall back and display a TTF alternative. The neat thing about OTF+SVG is that in addition to having stroke-based characters, it can also contain color information — and so this format is sometimes referred to as a “Color Font“. OTF+SVG is supported by Photoshop, Illustrator, Firefox, MS Edge, Pages, Keynote, TextEdit, and others. Because of this, SVG fonts do still exist, even though they aren’t often observed on their own.


5 thoughts on “Hershey Text v 3.0

  1. Thank you very much for this great, useful post!

    In the SVG Font EMSBirdSwashCaps.svg I have read that you did the SVG font conversion, I guess TTF was the source.

    You don’t by chance have notes on how this conversion can best be done, which tools are useful and whether each letter is drawn by hand or whether there are better ways?

    And: do you have e.g. a GitHub project, so that we can share self-converted SVG fonts with other AxiDraw users?

    Thanks a lot for any hint,
    kind regards,

    1. Hi Thomas,
      We did the SVG font conversion from an earlier version in the “historical” Hershey font format. Getting to a single-stroke font (in any format) from a TTF is a matter of hand tracing the glyphs. That tracing was done by Sheldon B. Michaels. (Detailed credits for each font are embedded in the font files.)

      We don’t have a github project for the fonts; that is going to stay on gitlab.

  2. Hi there !
    Very nice improvement to the already useful extension.

    I was wondering if you could get in touch with the guys at freecad development.
    More specifically someone involved in “draft workbench/shapestring” area.

    Hershey, single line, stroke (you name it) text capability would be very useful in freecad.

      1. Unfortunately not freecad.
        AFAIK as of version 0.19, there is a text shape stuff that you can use more or less as a sketch and hole, pocket or extrude into a solid. But nothing like Hershey Text.
        As a good deal of freecad is written in python, I think it would be doable to collaborate with them.

        Thanks anyway for the extension ;-)

Comments are closed.