gotcha

Author Topic: Single stroke fonts  (Read 1188 times)

April 13, 2019, 10:10:06 PM
Read 1188 times

lar3ry

  • Sr. Newbie

  • Offline
  • **

  • 4
  • Gender
    Male

    Male
I have been trying to create some "single stroke characters". My first attempt was to create some text using a standard Window font (Arial). I wanted to make characters that will vector engrave (K40 Whisperer terminology), and did not want to raster engrave them. Of course it's easy to have no fill, and colour the outline (stroke) blue. But that generates an outline of the character.

So I tried removing the stroke and colouring the fill blue, thinking that Whisperer would use it as a vector engrave path. Didn't work. When I put it into Whisperer, the colour was changed to black, meaning that I could only raster engrave it.

I did manage to find a single-stroke font called CamBam, that I think is OK, but it's very limiting. I am hoping there's a way to use the fill part of a character, and change it to a stroke. If not, I think it would be a great feature to add.

Any ideas?

April 14, 2019, 12:57:14 AM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,937
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

I think you might be looking for Hershey Text.  See Extensions menu > Render > Hershey Text (which ought to be under the Text submenu, rather than Render....).  Also, here's an external extension (meaning that it needs to be installed) that provides it:  https://github.com/HardRainbow/Hardy-Hershey-Text

I've never used those, so I can't recommend one or the other.  Let us know if  you need instructions for installing the 2nd one.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 14, 2019, 09:00:49 AM
Reply #2

lcm

  • Jr. Member

  • Offline
  • ***

  • 17
I'm not familiar with cutting devices, but I have a pair of techniques that could possibly answer your question.

First, you need to convert the text into path (Shift+Ctrl+C), ungroup it into separate characters (Shift+Ctrl+G), and join them into a single path (Shift+Ctrl+= or Ctrl+NumpadPlus). Add stroke and remove fill from resulting path.

Inset outlines
1. Select your text-path and use menu Path → Linked Offset. Use small diamond-shaped node to inset the stroke.
2. Select text-path again and repeat it few times (if needed) to cover fill area. If you can't budge the inset-node, try disabling snapping (Shift+5).
3. Select all inset-pathes and convert them to regular pathes (Shift+Ctrl+C).
4. Sometimes you'll get inkblot-like artifacts from insetting, and usually it's easier to manually remove them with node tool (F2 or N).

Barred outlines
1. Draw a narrow rectangle (F4 or R) tall enough to fit your text height.
2. Use menu Edit → Clone → Create Tiled Clones. In the Shift tab set Shift X per Column to 100% and number of Rows, Columns to 1 x 100 (more or less columns, depending on the length of your text). Click Create. It should generate barred grid of cloned rectangles.
3. Select all cloned rectangles, unlink them (Shift+Alt+D), and join them into a single path (Shift+Ctrl+= or Ctrl+NumpadPlus).
4. Put that grid-path on top of your text-path, select both grid and text-path, and apply Path → Division (Ctrl+/).
  • 0.92.4
  • Windows 7 SP1 64-bit

April 14, 2019, 12:20:37 PM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,566
    • VektorRascheln
For the first version, one could also use the area fill option of the gcode tools, for the second, the hatch extension would work.

April 14, 2019, 12:54:15 PM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,937
  • Gender
    Female

    Female
    • Inkscape Community
Well it seems I have a different idea about what a "single stroke font" means, than lcm and Moini.  It wouldn't be the first time if I misunderstood.  But that CamBam font which lar3ry references looks like Hershey Text.

The Hershey Text extensions probably offer a couple more options than CamBam.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 14, 2019, 03:44:22 PM
Reply #5

lar3ry

  • Sr. Newbie

  • Offline
  • **

  • 4
  • Gender
    Male

    Male

Well it seems I have a different idea about what a "single stroke font" means, than lcm and Moini.  It wouldn't be the first time if I misunderstood.  But that CamBam font which lar3ry references looks like Hershey Text.
The Hershey Text extensions probably offer a couple more options than CamBam.

I already have Hershey Text, as it was part of recent Inkscape versions.
However, the fonts are still limited to a few that I could use.
As well, the Hershey Text is not a Windows font. In order to use any of the fonts in it, One has to elect the extension (Render->Hershey Text), type in the text, then apply, then move/resize, etc. Cambam, on the other hand is a Windows font, and can be installed into the font directory, allowing one to just click on Text, and treat it like any other system font.

To me, the ideal solution would be to have Inkscape do automatically, what the extension "Custom Stroke Fonts" does. Unfortunately, most of the work in that is done manually, by defining all the font characteristics and using bezier curves to draw the cnterline strokes within the character itself.  In the extension, it's easy enough to import a system font, but the rest is pretty difficult for someone without font experience. I'll still be playing with it, though. It's a challenge.

I'm not familiar with cutting devices, but I have a pair of techniques that could possibly answer your question.

Thanks for the response. I could not get any of them to work, and assuming I did, it looks like it would not generate an installable font.

For the first version, one could also use the area fill option of the gcode tools, for the second, the hatch extension would work.

I haven't used the gcode tools at all yet, but I certainly will try it.

April 14, 2019, 04:45:32 PM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,937
  • Gender
    Female

    Female
    • Inkscape Community
I'm not sure what a "Windows font" is.  Do you mean that you want it to be a font that you can install on your system?  I don't know of anything like that.  It sounds like you've already found one though. 

Also, I don't think I've heard of an extension called Custom Stroke Fonts.  Can you give me a link to it?

What you're asking is not easy to do.  You'd have to either find another font like CamBam, or else make one yourself.  Yeah, there's just no easy way to create what you want with Inkscape.  Certainly doing that with another font would take much, much more time than using the Hershey Text extension.

If you're interested to try, I'd probably try to use Extensions menu > Generate from Path > Interpolate.  I think it IS possible to do, it's just going to take even more time than using Hershey Text.

I guess you could try the Centerline Trace extension.  For that, you'd need a raster image of the text, and use the Centerline Trace engine on it.  For myself, it wouldn't be acceptable, because it tends to form sort of knots where lines intersect.  But I guess it's remotely worth a mention.  https://github.com/fablabnbg/inkscape-centerline-trace
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 14, 2019, 07:30:30 PM
Reply #7

lar3ry

  • Sr. Newbie

  • Offline
  • **

  • 4
  • Gender
    Male

    Male
I'm not sure what a "Windows font" is.  Do you mean that you want it to be a font that you can install on your system?  I don't know of anything like that.  It sounds like you've already found one though.

By a "Windows Font", I do mean one that can be installed as a font on a Windows machine.
CamBam Stick (Just realized that 'Stick' is part of the name) is the one I found that will install.  There are 9 different variation in the package, covering italic, script, tall, condensed, etc. They are pretty good, but there are a lot of fonts that are completely different than anything in the CamBam package. Two of my favourites are Vag Rounded and Broadway.

You can find CamBam Stick at http://imajeenyus.com/computer/20150110_single_line_fonts/index.shtml?fbclid=IwAR0UTE81D8c_2qDUqj2hWZVb1V5Eosys7aer2NhnZ3P5JxsFCsq0QED3SA8#mecsoft

Quote (selected)
Also, I don't think I've heard of an extension called Custom Stroke Fonts.  Can you give me a link to it?

https://inkscape.org/~khemadeva/%E2%98%85create-custom-stroke-fonts-and-render-text-using-them
There's a couple of links there, including one to the github page.

Quote (selected)
What you're asking is not easy to do.  You'd have to either find another font like CamBam, or else make one yourself.  Yeah, there's just no easy way to create what you want with Inkscape.  Certainly doing that with another font would take much, much more time than using the Hershey Text extension.

Fair enough. I don't know enough about fonts or Inkscape to know what's easy and what's hard to implement.

Quote (selected)
I guess you could try the Centerline Trace extension.  For that, you'd need a raster image of the text, and use the Centerline Trace engine on it.  For myself, it wouldn't be acceptable, because it tends to form sort of knots where lines intersect.  But I guess it's remotely worth a mention.  https://github.com/fablabnbg/inkscape-centerline-trace

Thanks. I'll have a look at it. Perhaps I can come up with something that does the centre line from paths, rather than from a raster image.

April 14, 2019, 09:55:52 PM
Reply #8

lcm

  • Jr. Member

  • Offline
  • ***

  • 17
Thanks for the response. I could not get any of them to work, and assuming I did, it looks like it would not generate an installable font.
Inkscape cannot create TrueType/OpenType-fonts, at least from what I know. You could possibly use Inkscape's built-in SVG Font Editor, then convert svg-font to TrueType-font using FontForge, but unless you have vast amount of spare time, I wouldn't recommend that.

Wouldn't using blue stroke with black fill for text solve your problem? If not, what is different from what you're trying to achieve?
  • 0.92.4
  • Windows 7 SP1 64-bit

April 15, 2019, 12:17:04 AM
Reply #9

lar3ry

  • Sr. Newbie

  • Offline
  • **

  • 4
  • Gender
    Male

    Male
Inkscape cannot create TrueType/OpenType-fonts, at least from what I know. You could possibly use Inkscape's built-in SVG Font Editor, then convert svg-font to TrueType-font using FontForge, but unless you have vast amount of spare time, I wouldn't recommend that.

Wouldn't using blue stroke with black fill for text solve your problem? If not, what is different from what you're trying to achieve?

Blue stroke with black fill is fine for engraving either the fill (raster engrave), the outline (vector engrave) or both. What I want is single-stroke fonts. By that, I mean fonts that are made without a fill, but only with lines. Of the three choices, I tend to like the outline only characters, but they tend to appear variable darkness because of the proximity of some parts of the outline to the part of the outline opposite it. Picture an 'A' in Century. The left leg is thin, but the right leg is thick. One leg of the A will appear darker than the other.

Have a look at the attached file to see one single-stroke font, CamBam Stick 1.
Because you are unlikely to have the font on your machine, I converted it to paths.

CamBam Stick 1 sample.svg
*CamBam Stick 1 sample.svg
(75.02 kB . 302x149)
(viewed 632 times)

April 15, 2019, 08:54:39 AM
Reply #10

lcm

  • Jr. Member

  • Offline
  • ***

  • 17
If I understand you correctly, you want to get centered strokes for any font?

singlestrokefontexample.png
*singlestrokefontexample.png
(15.68 kB . 696x172)
(viewed 632 times)


I think, there's no simple way to achieve that, especially if you want to get good results, and the extension you mentioned is your best choice (so far).

First, font outlines are pretty complex, and I cannot think of a tool that can reliably find centerlines of (for example) Lobster glyphs.
Second, you can't get truly single-stroke installable font. TrueType font outlines are always represented as a set of closed loops. Even in CamBam, though it's zero-width loops, every point is still passed twice.
  • 0.92.4
  • Windows 7 SP1 64-bit

April 15, 2019, 08:54:02 PM
Reply #11

brynn

  • Administrator

  • Offline
  • ******

  • 3,937
  • Gender
    Female

    Female
    • Inkscape Community
Hershey Text is made specifically for this reason.  It's really the only solution I've ever heard about.  I suppose it's possible you could find some Hershey Text with a larger variety of fonts.  Let us know if you do!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 16, 2019, 02:28:56 PM
Reply #12

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,566
    • VektorRascheln
It is actively being developed, and more fonts are being added. Another extension that comes with options to convert existing fonts to the Hershey kind of font is here: https://inkscape.org/~khemadeva/%E2%98%85create-custom-stroke-fonts-and-render-text-using-them (I didn't test it)

April 16, 2019, 04:14:01 PM
Reply #13

brynn

  • Administrator

  • Offline
  • ******

  • 3,937
  • Gender
    Female

    Female
    • Inkscape Community
Oh nice!  Just what lar3ry needs!

Although I don't know if it's going to make an actual font, or if it would work like the Hershey Text works.  He or she will just have to install it and try it.

Definitely let us know how it goes, lar3ry.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann