Ali Kanat
Ali Kanat

Reputation: 1889

Generating Text out of curves and lines

I am working on a project in which i use a library to export geometry as IGES. This library only allows me to export lines. I want to create labels for my export by rendering some text next to it. For example, i can export a circle and i want to render a text next to it using only lines that shows the radius.

I can already use bezier curves so i thought of using vector graphics. Checked out some SVG parsers, Freetype library. My initial thought was to access curves on glyphs and generate my own method for text rendering. However, it seems like Freetype generates bitmaps and i cant really use bitmaps with this library i am using. Also even using glyphs seems a bit overkill because glyps contains outline of letters but i actually do not need an outline. Only centerline would be fine in my case.

Glyph example

My question is, is there a way i can import some font file or something which contains control points of curves that are centerlines of letters and numbers so that i can generate text in my IGES export? Or is there an easier way to access glyph lines using Freetype? I would appreciate if anyone has any experience with fonts and give me some tips. Thank you in advance

Upvotes: 1

Views: 378

Answers (1)

David Jones
David Jones

Reputation: 5194

You may want to look at Hershey fonts. A series of fonts designed for pen plotters. Starting in the 1960s at the US Navy, it now has a huge repertoire of Glyphs.

That said, it seems like it might be tricky to get hold of the actual vector data in a format you can use. http://www.whence.com/hershey-fonts/ or https://github.com/frankrolf/python-hershey might be a good start.

They're often built-in to plotter software, so that might be another option.

Upvotes: 1

Related Questions