Any ideas?
--
Matthew Beckler
I'm not aware of a set of the Hershey fonts (simplex, or otherwise) available
for Inkscape. I suppose one could easily output them all (simplex, duplex, triplex,
Fraktur, etc.) into a single Inkscape page and you just copy, paste, and resize them
as you need them. Tedious but would work. Personally, I'd rather stick with the
inefficient plotting of our modern day fonts then go back to the Hershey fonts.
Dan
P.S. I, and probably Chuck as well, recall the days when the Hershey fonts were
the cat's whiskers.
Right. So the Hershey fonts are true vector fonts, which came into being back when pen plotters were a little more popular. Here's some additional background information, along with samples:
http://idlastro.gsfc.nasa.gov/idl_html_help/About_Hershey_Vector_Fonts.html
http://idlastro.gsfc.nasa.gov/idl_html_help/Hershey_Vector_Font_Samples.html
http://www.batbox.org/font.html
The root problem is that there is a fundamental incompatibility between these old "vector fonts" and modern "outline fonts" such as postscript and truetype. Vector fonts define the character by the stroke-- the pen line drawn around the perimeter. It is possible to define a true single-stroke vector font that works much like hand-written text-- only going over each stroke of each letter once. By contrast, outline fonts define the character by the fill-- the area encompassed by the perimeter -- so they *necessarily* form a closed shape. In other words, it's not generally possible to have a "single stroke" outline font, because there's no stroke at all-- just a filled area.
Inkscape (just like other drawing programs that use these modern outline fonts) expects every font to complete full outlines (that it can fill in) and so if you were to give it a single stroke TTF font, it will, um "helpfully" close the paths for you. The letter 'C' will render as a closed shape, for example.
Now, there *are* true single-stroke TTF fonts available, but they behave a little strangely with all those caveats. A set of fairly nice ones is available for download here, of which Machine Tool gothic is my favorite:
http://www.featurecam.com/general/support/engrave_fonts.asp
To use these fonts with Inkscape and the Eggbot, you'll need to do several things:
1) Convert to path, as per usual.
2) Set fill to 'none,' and select some visible stroke value so that you can see the vector lines. (This is in contrast to normal fonts, where you need the fill to be visible, and the stroke can be 'none.'
and
3) Individually edit the path for each character to delete the last data point, which is (I believe) automatically added by Inkscape to close the path.
Step 3 is totally impractical for one-off designs, but it's a freaking miracle time saver for mass production, if you're plotting the same thing over and over. (We use these fonts to create efficient marking paths for use with the laser engraver.)
While I haven't looked into doing so yet, it occurs to me now that we might be able to write an Inkscape extension that will automatically delete that last point, which would actually make this into a not-too-painful method.
-Windell
In general it's more than just the last data point. Try "A" for example in the machine gothic. Issue being that some
of the paths are a single SVG path but with multiple, disjoint line segments (i.e., with non-termimal pen ups within
the path).
But, I suspect that if an extension removed the final "Z", "z", xor last data point from each continuous line segment
AND then fixed up the start of the next line segment within the path (in the case of relative path coordinates), then
everything would be okay. And such an extension might as well also set the fill to none and the stroke to black in the
parent group so as to handle that aspect as well.
Finding all the characters can be done with an assumption and xpath: assume that any group, <g>, with font info in its
style attribute is a group of font characters. Then walk all that groups child paths, <p>, and do the extension
magic.
Dan
P.S. For the letter "A" I had to change
<path
d="m 159.96205,416.50394 42.25781,-94.5 42.25782,94.5 -84.51563,0 m 15.67969,-34.52344 53.29687,0.0703 -53.29687,-0.0703"
style=""
id="path3009" />
to
<path
d="m 159.96205,416.50394 42.25781,-94.5 42.25782,94.5 m -68.83594,-34.52344 53.29687,0.0703"
style=""
id="path3009" />
> For instance I was never able to get the single line truetypes working in inkscape despite trying the process windell detailed. I was using Inkscape under OS X 10.6.5 with the latest XQuartz.
That's my configuration as well, so the issue is probably elsewhere. Can you say in what way it wasn't working?
-Windell
Too true. But... we don't actually *need* to use one of the modern font formats to solve this problem.
Here's a possible approach, thinking ahead. Suppose that we write an extension where you type a string, and the extension *draws* that text on your page for you. It would contain the definition of a character set, and output not a text object, but a grouped path, which you can move around and resize. We could base it on one of the real Hershey fonts, even. Maybe even a font-face drop-down menu. :)
I just put the .ttf file into /Library/Fonts/ and then exited and restarted Inkscape.
Inkscape, when it detects new fonts is "slow" to startup. But, you'll see that it is
running and consuming plenty of CPU as it re-digests your various font directories.
I mention this on the offchance that you didn't get this far with the fonts.
After you get, say, machine gothic recognized by Inkscape, when you write some
letters with it, you will think that it's not working at all. Just some big,
filled, illegible shapes. It's not until you disable the fill and then enable
the stroke that you will see something resembling characters and not chunky blobs.
Dan
Theory says you could put each Hershey font into a separate .py file and
have the extension import the proper .py file and draw from it. Oh, I keep
on forgetting. Computers are faster and have more memory than the PDPs and DECSYSTEMs
I used to have to do this stuff on. No need to make such optimizations these days.
But, yes this is quite doable. Any volunteers? Be sure to get the Hershey math
symbols font please.
Dan
P.S. I'm not volunteering. Last time I did this was for pre 1.0 Ghostscript. (Later
redone by Tom Wolff when the font support got revamped.)
P.P.S. I'm curious as to how well the Triplex Roman will look: I'm guessing either hideous
or somewhat nice (with a fat pen that will make the inside stroke look enough like a solid
fill).
Still have your old code as a starting point? ;)
Seriously though, I'll look around and see if someone's already most of
the way there. It's likely that this won't be too difficult, at least for
plain text strings.
> Hi All,
>
> I was playing with these fonts and some JavaScript to read and work
> with them. In the process, I've generated a set of SVGs containing all
> of the glyphs of each set.
>
> You can find them (and instructions for using them with Inkscape) on
> Thingiverse:
>
> http://www.thingiverse.com/thing:6168
>
> Thanks,
> Marty
Thank you, Marty, that's awesome!
-Windell
--
You received this message because you are subscribed to the Google Groups "EggBotUser" group.
To post to this group, send email to eggbo...@googlegroups.com.
To unsubscribe from this group, send email to eggbotuser+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/eggbotuser?hl=en.