Marty McGuire

Posts Tagged hershey

2011
Fri Feb 25

Thing-a-Day 2011 #25 - Scribbling in SVG (+Hershey font typing)

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

Added some scribbling to my little JavaScript app, which also gets saved to the SVG.

It's not great (my insistence on making these things map to the sticky note image means they don't line up right with the mouse), but it works!

Scribbs
As before, you can play with it here: http://schmarty.net/hershey_js_demo/
Thu Feb 24

Thing-a-Day 2011 #24 - Hershey Fonts in JS, now sized for Unicorn Plotting!

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I tweaked my little Hershey Fonts in JavaScript toy a bit. Now, the SVG data that it produces is at the right size and scale to plot on a sticky note on a MakerBot Unicorn.  Save the SVG content, load it in Inkscape, and save it as .gcode using my Inkscape extension for Unicorn.

At long last, after a bunch of little thing-a-days, I can write out a sticky-note:

Belaird
Save the SVG data and open it in Inkscape:
Belaird-inkscape

And save it as G-Code for plotting on the Unicorn!

Belaird-gcode

Matt Griffin was kind enough to plot it for me on one of the Thing-O-Matics at the BotCave:

Belairicorn

... sorry for the Bel-Air... :)

You can play with it here: http://schmarty.net/hershey_js_demo/

Wed Feb 23

Thing-a-Day 2011 #23 - SVG Output for Hershey fonts in JavaScript

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I really wanted to get SVG manipulation going in this demo, so I have ported the rendering (once again), this time using the jQuery SVG lib, which is really nice and easy to use: http://keith-wood.name/svg.html

Hershey-js-svg-output
You can play with it here: http://schmarty.net/hershey_js_demo/index.html
Tue Feb 22

Thing-a-Day 2011 #22 - Hershey Fonts in JS - on a Sticky Note!

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

Ok, this is more a kind of clever image arrangement than anything else, but it looks nice, I think.

Writing_on_a_sticky_note

You can play with it here: http://schmarty.net/hershey_js_demo/index.html

Until I change it again!

Mon Feb 21

Thing-a-Day 2011 #21 - Auto-scaling Hershey fonts in JavaScript

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

Ok, this is kind of fun, even though the code is very naive.

I've added a height-check at the end of my line-breaking code. If there are too many lines of text to fit within the allowed space, the algorithm will rescale everything and try again:

Auto_scale_hershey_js
This isn't great for real-time text flow, but it is fine for fitting text, I think.
Sun Feb 20

Thing-a-Day 2011 #20 - Hershey fonts in JavaScript on the canvas

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I haven't been making as much progress on my "draw things in the browser so a robot can draw them on the Unicorn" project, so I decided to take a stab at cleaning things up a little to make that easier.

Today I rewrote my little demo to use canvas 2D instead of Raphael.js.  It looks the same, for the most part:

Hershey_js_canvas
But being in canvas land instead of Raphael land means I can do real stacked transforms easily, without having to keep track of them myself. For instance: ROTATION!

Canvas_rotated
Thu Feb 17

Thing-a-Day 2011 #17 - Simple line-wrapping for Hershey JS demo

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I've decided to slowly expand this drawing-stuff-in-the-browser demo, and added some simple line-wrapping to the code on my demo page:

http://schmarty.net/hershey_js_demo/

Word wrapping is an interesting topic, and I hope to get this cleaned up a bit with features like breaking up words if they are too long, improving the algorithm to make nicer "squared" paragraphs, etc.

Line_wrapping_hershey_js
Sun Feb 6

Hershey Fonts in SVG

Files

hershey_svg.zip
149280 bytes. Updated
hershey.zip
107203 bytes. Updated
astrology.svg
32309 bytes. Updated
cursive.svg
20791 bytes. Updated
cyrilc_1.svg
22660 bytes. Updated
cyrillic.svg
23636 bytes. Updated
futural.svg
15480 bytes. Updated
futuram.svg
22512 bytes. Updated
gothgbt.svg
35125 bytes. Updated
gothgrt.svg
36666 bytes. Updated
gothiceng.svg
35041 bytes. Updated
gothicger.svg
36582 bytes. Updated
gothicita.svg
30219 bytes. Updated
gothitt.svg
30303 bytes. Updated
greek.svg
16383 bytes. Updated
greekc.svg
21662 bytes. Updated
greeks.svg
15541 bytes. Updated
japanese.svg
55942 bytes. Updated
markers.svg
5566 bytes. Updated
mathlow.svg
16193 bytes. Updated
mathupp.svg
15783 bytes. Updated
meteorology.svg
16078 bytes. Updated
music.svg
26086 bytes. Updated
rowmand.svg
23433 bytes. Updated
rowmans.svg
15379 bytes. Updated
rowmant.svg
31035 bytes. Updated
scriptc.svg
25598 bytes. Updated
scripts.svg
22608 bytes. Updated
symbolic.svg
19740 bytes. Updated
timesg.svg
22309 bytes. Updated
timesi.svg
23030 bytes. Updated
timesib.svg
30928 bytes. Updated
timesr.svg
21818 bytes. Updated
timesrb.svg
30830 bytes. Updated
math-drawing.svg
8619 bytes. Updated

This work is licensed Public Domain.

Description

Making text for Unicorn or EggBot plots isn’t always a fun process. Most tools require you to convert text into paths, and even then you get the outlines of shapes, which can often turn messy at small sizes.

mifga pointed me towards the Hershey fonts[1]. They’re a set of fonts for vector plotters named after creator Dr. A. V. Hershey who made them for the National Bureau of Standards.

These files are in a weird, weird, format. But after some normalizing, wailing, and gnashing of teeth, I was able to write some code to parse them and spit them back out as SVG! Now you can use these fonts in your Unicorn drawings.

Each SVG contains a layout of one of the Hershey fonts. The hershey_svg.zip file below contains all of the SVG files. The hershey.zip file contains the (cleaned up) original .jhf files. math-drawing.svg is just an example of using these glyphs, including scaling and stretching. I think the result is nice!

To use these in Unicorn plots, you’ll want to grab my Unicorn G-Code extension for Inkscape[2].

[1] Hershey fonts - http://emergent.unpythonic.net/software/hershey
[2] Unicorn output for Inkscape - http://www.thingiverse.com/thing:5986

Instructions

To use these fonts in your Unicorn plots:

  1. Download the SVG file containing the font of your choice, or grab the whole hershey_svg.zip to get them all.
  2. In your Inkscape drawing, use File | Import to load the font you want
  3. Drag around and duplicate the characters that you want to use.
  4. Delete the ones that you don’t.
  5. Plot it!
    • (Unicorn users) Save your file and Save a Copy to get your .gcode!
    • (EggBot users) Plot directly from Inkscape. :)