Single Stroke font ( like font for CNC / engraving )


#1

Hi,
I am checking out the trial version of Glyphs and it looks really good!

I want to start using Glyphs to create single stroke fonts. What I mean is: a font that doesn’t contain any closed paths. So if I would use that font to type something in Illustrator, I would need to set ‘fill’ to nothing and ‘stroke’ to a certain thickness if I want to have it rendered correctly.

Is it possible to create a font like this with Glyphs? I’m thinking it is impossible, because of this statement in the Glyphs blog: “Did a whole path go missing in the final font? Perhaps it was open. Open paths are ignored at export time. So, all paths should be closed.”
(link: http://glyphsapp.com/blog/drawing-good-paths/ )
I am a programmer myself and understand how “correct” polygons holes etc. should be constructed (winding rules etc.) but it seems unbelievable to me that a font file would be unable to contain open paths.

The font will be used for a tool that draws letters similar to a pen plotter, some info about it is here: http://www.flickr.com/photos/worldreceiver/8207706600/in/set-72157632025182152

best,
Tim Knapen


Help with Glyphs path definition for single-stroke typeface (for CNC/engraving use)
#2

You can have open paths in your .glyphs file, but OpenType does not support open paths. I think PS Type3 did.

But you do not have to export anything. You can just type something in Edit View and create a PDF through the Print dialog.


#3

Hi Mekka,
Thanks for the quick reply.

So what you are saying is that none of the current font formats are supporting open paths, right? I was kind of hoping it was just a rendering thing (like for example illustrator automatically rendering every path as a closed contour)
That’s really too bad, because our preferred way of working is:

  • Do all layout (including setting text) in Illustrator.
  • Export everything to an SVG file.
  • Import the SVG the into the controller app for the drawing machine. This app then interpolates all bezier paths etc. and sends the movement commands (similar to G-Code) to the machine.

It sounds like I will have to build my own font format and layout software for this project. :frowning: Or am i missing something?


#4

Yes. That’s pretty much how it is. I would do the typesetting in Glyphs, then import the PDF into Illustrator.

You could try Type3, but I bet you will run into problems with the SVG then. Also, I doubt recent AI versions support it.

Or do it with a design hack: Close all your paths with a node you put 100 units above everything else, then typeset in AI and convert to paths. It shouldn’t be too hard to just select those top connector nodes and delete them in one step.

PS: If you do develop your own font format, please write a filetype plugin for Glyphs :slight_smile:


#5

The easies would be to write a svg export script. Then you could skip Illustrator altogether. Depends a bit on what layout you need to do. Can you post a screenshot?


#6

Hi Georg,

Here are all kinds of designs we did with the machine already, where every letter was just a simple illustrator drawing we were placing by hand: http://www.flickr.com/photos/worldreceiver/sets/72157632025182152/

Here are some screenshots of the first font we’d like to do.
Stroked :

http://www.flickr.com/photos/worldreceiver/8517909271/in/photostream/

only paths:
http://www.flickr.com/photos/worldreceiver/8519021412/in/photostream/


#7

We can’t skip Illustrator, because we need some kind of app to combine illustrations with text. it’s also the easiest to use for the designers in my studio.

it really sucks that there is no font format that supports this (+ is usable in illustrator etc…)
Making the layout in Glyphs is not a very good option, because we want to design a book that combines illustrations and text. Everything in this book will be single-stroke and set in our own fonts.

The reason we need SVG is because that’s the only vector format my software can parse right now. (and i like open standards)


#8

And what about just doing the typesetting lin-o-type style in Glyphs and assembling the lines in illustrator?


#9

line by line sounds very annoying to me :frowning:

But I just discovered something… apparently .ttf fonts does support “open paths”, although illustrator renders them quite horribly.

Here’s the result of a quick test I did with the single stroke font “Machine Tool” (machtgth.ttf) : http://www.flickr.com/photos/worldreceiver/8519316684/in/photostream

Does Glyphs export .ttf?


#10

I think AutoCAD uses stroke fonts and has its own font format for it. AutoCAD was made to drive machines like yours.

So, instead of writing your own solution you need to find a CAD app that supports the SHX font format and then write a SHX export plugin for Glyphs (I can help with that).

But Rainers suggestion to draw and layout everything in Glyphs should work quite well. Just print to PDF and you can use the hole composition in Illustrator.


#11

Indeed, there are some OpenType hacks called OPF (open path font) or ‘Thin Font’. They claim they only work with a software called ‘Make The Cut’:
http://www.letteringdelights.com/searchsite_detail.php?id=2406
http://underacherrytree.blogspot.co.at/2012/04/new-lettering-delights-thin-fonts.html

The OPFs contain no closepath, here is an A, output by TTX/FontTools:








I wonder whether this works with PS based OTFs as well, for this would make things much easier on the font development side. If I send a test file to the e-mail address on your website, can you try and put it through that ‘home-made drawing machine software’ of yours?


#12

ok, just a little update.
Thanks to your super fast help it seems like I am actually getting somewhere!

Mekkablue sent me an email with a single stroke font he quickly made. I ran it through my software and… the result is perfect!

my little victory image: http://www.flickr.com/photos/worldreceiver/8519592936/in/photostream

:slight_smile:


#13

Err… here is something I did not know myself so far.
If you have open paths and you choose not to remove overlaps or autohint when you export the OTF, the paths stay open in the final OTF. Here’s the charstring of the A from the screenshot (via ttx):

600 26 14 rmoveto 210 63 140 392 57 hhcurveto 57 133 -408 -204 52 hvcurveto 205 -81 -140 45 -253 hhcurveto endchar

Most rendering engines will interpret a closepath statement into the code (that’s why the AI screenshot looks like it does), but Tim’s CNC software chooses not to. And that’s all we need for this purpose.


#14

amazing! I tested exactly this immediately after downloading the Glyphs trial.
It exported the font as “Newfont.otf” just fine, but when I loaded it into Font Book and installed the font to my system it wouldn’t show up in Illustrator.

After the amazing help of mekkablue, I gave the font a name and tried it again. now it shows up fine in Illustrator.

thanks a lot guys!!


#15

“If you have open paths and you choose not to remove overlaps or autohint when you export the OTF, the paths stay open in the final OTF. Here’s the charstring of the A from the screenshot (via ttx)…”

That’s a pity… I was hoping I could use that method to export the Blumenkind paths into FontForge for stroking, but the paths all end up closed when I open the exported OTF. I guess I could reopen them all by hand, but that’s a lot of work…


#16

That is how FontForge interprets the path. (And let me once again reiterate my advice not to use OTF as exchange format, but you know that already, I guess.)


#17

Hi!
I’m working with open paths and it keeps closing the paths when I generate it. I tried unticking remove overlaps and autohinting when exporting but won’t respond. Is their any dummies common mistake that I might be making?
Thanks!


#18

Martina Flor
Don’t bother in answering this last one, I just made it. It was me doing things wrong :slight_smile:


#19

It is a tricky topic.

Technically, all paths must be (and are assumed) closed in an OTF. Thing is, practically every interpreter implies a closepath instruction at the end of a charstring. A charstring is the literal definition of the glyph. One example in TTX code:

600 139 318 rmoveto 304 -10 -100 94 -204 10 rlineto endchar

The first line defines the width of the glyph as 600 units, then moves the first point of the path to x=138, y=318. rmoveto means “relative move-to”. A “move-to” instruction indicates the start of a path. The second line draws three lines with rlineto (relative line-to): (1.) from x=138, y=318 (this is where we left of at the “move-to”) 304 units to the right, and 10 down; (2.) then 100 to the left and 94 up; (3.) then 204 to the left and 10 up. Finally, the endchar instruction says this glyph is finished.

This is what it looks like in Glyphs:

open

You see, there is no closing (fourth) line defined. The third line ends somewhere above the originating point. Now here’s the deal: Almost every rasterizer or interpreter that finds this glyph will assume an implicit closing line from the final line-to point to the originating move-to point. That means that the same charstring will look like this when displayed:

closed

The point is that Glyphs can differentiate between those two, while OpenType cannot. And Glyphs will keep the open path if the Remove Overlap option is not ticked off at Export. Thus, we can control which lines are explicitly defined. And this is all we need for the plotter. Because the plotter, by its very nature, does not implicitly assume that closing line I mentioned above.

I hope this clears up any confusion.


#20

I’ve been trying to get this to work for me (I want to use a custom single line font in Rhino), but I haven’t been able to get open paths to work properly. I have an average of 2-3 open paths per glyph and everytime I export the font (as a TTF and with ‘remove overlap’ not ticked) some paths go missing or collapse in on themselves.

There is a way to make a single line font with closed path by simply duplicating every point (on top of one another) and creating compound paths that don’t have a thickness. But, the flaw in this method is that the CNC operation will be doubled as the tool will have to run the path twice (wherever the path/points overlap).

So, I’d really like to get these open paths working with Glyph. Does anyone have any other ideas/advice for me? Seems like Tim and Martina got it working.