Creating Fonts with Inkscape and FontForge | Part#3

<Part#2> - Table of Contents - <Part#4>


Part#3 - AutoTracing alphabet & Pair Kerning & Accents
In this tutorial, we use Inkscape to trace a sample of calligraphy, and make a font from the resulting glyphs. Features of this font include kerned pairs and accented vowels. Starting from now, I'm assuming that you know how to name a font, generate it, setup Inkscape, trace letters using the spiro tool or Beziers, figure out ascent+descent, kern pairs...

 

  1. Create a font project named "Font#3"

  2. Tracing the glyphs

    1. Download, then drag and drop this image in Inkscape.

    2. Right click the image, then Trace Bitmap with Mode|Brightness cutoff {Threshold=0.600} and Options|Supress speckels {Size=10}. Then delete the image and this is the result.

    3. There are many way to isolate the letters. Here, I will be tracing polygons behind each letter that I want with Bezier curves (T,o,w,m,a). Here's what it will look like : result.

    4. To do this, select the Draw beziers tool in 'create regular bezier path' mode. Just put some points to encircle the letter that you want and close the curve to make it into a shape. Right-click it and choose Fill and stroke. From there, remove the stroke and add a light fill color. You can move a shape to the background with the PageUp/PageDown keys on your keyboard or with Object|Raise/Lower.

    5. Then, select one shape and the traced image and call Path|Intersection. result

    6. Copy the glyph, go back with ctrl+z and paste it to the side. result

    7. Repeat until you have all the glyphs : result

    8. Find the ascent/descent : here ascent = 76px, descent=0px

      Setting the ascent right to the top of the tallest letter means there will be virtually no space between two line of text, so you might want to set the ascent (or descent) a bit bigger.

      If later, you find there is not enough space between two lines of text, you can always do Element|Font Info|General uncheck scale outline and increase either of ascent/descent without breaking your positioning. Don't forget to validate OK.
      This is what I did, by extending descent to 30 afterwards.

  3. drawing the accents

    1. Simply draw a few accents using the Bezier tool, here is what is should look like.
  4. Setup in FontForge

    1. Set ascent/descent

    2. Copy the glyphs from Inkscape. You might encounter an issue with the letter "a" not having a hole when copy-pasted. To fix this, select the letter in Inkscape and do Path|Reverse.

    3. Set both bearings of the glyphs Metrics|Set Both Bearings| to 2. Then tweak the spacing. Here's how I set mine.

      Notice how we will need to kern the pairs "aw" and "TT"

    4. Create the glyph for "space" of width=10.

  5. Kern the pairs 6. Exactly like in Tutorial#2. 7. Here's the result.

  6. Add the accents

    1. Import them

      1. Copy-paste them from Inkscape like any other glyph. Here are their glyph numbers : Grave (0x60), Acute (0xb4), Dieresis (0xa8), Circumflex (0x5e).
      2. result
    2. Add the anchors

      1. First, you need to create an anchor class.

      2. Go to Element|Font Info|Lookups|pane GPOS. From there, Add Lookup {Mark to Base Position, New->mark, Lookup Name=accents}.

      3. Select the lookup and Add subtable then OK, New Anchor Class and type in "accent" as a name then OK.

      4. Now, close Font Information window and edit one of the accent. Right-click and Add Anchor->Accent,mark(NOT ~~base mark~~), do this to each of the accents, and position the anchor below the accent. example

      5. Then, for each letter, add an anchor as a base mark this time, and position it where the accent should go. example.

        Tip : you can copy-paste anchors from one letter to the next then drag it into position, just make sure you copied the right type (mark or base).

      6. Finally, to review your positioning, access Element|Font Info|Lookups|pane GPOS|accents|accents-1|accent->Anchor Control. You can drag the star around to position the marks. You can select another letter in the list. You can also select and accent to check that they are all about the same height.

      7. Don't forget to click OK to save your changes once you're done.

    3. build the accented glyphs 9. Finally, select all the glyphs ctrl+a, then Element|Build|Accented Glyphs

       > The default encoding doesn't have many letters, if you need more, do `Encoding|Reencode|(Unicode, BMP)`, then re-run `Buid Accented Glyphs`. Other subsets of Unicode are fine too, simply chose an encoding that has the letters you need.
       >
       >Tip : You can toggle `Encoding|compact` to only show the glyphs that you created, which will make accessing them much easier.
      
  7. Generate the font

    1. result.

PS : The 'real' diacritics can be found in the Unicode range starting at U+0300 an they will override the symbols such as Grave, Dieresis, Circumflex... Those are not meant to be used as marks in this way, this is just FontForge using the next best thing if you don't provide it with the actual symbols for diacritics.

PPS : Try typing 'T^' with the font, and see how the glyphs combine even though the letter 'T^' does not exist! This is not what you would expect because '^' is usually a simple glyph, not a mark that can stack on other glyphs -- this is handled by your OS instead, which replaces specific keystrokes with ligatures (é,à,...). The marks that we created here do not work like this, and will stack on top of any matching base mark that is right before it (and multiple marks will pass through one another and stack on the base mark together!). You can of course exploit this behaviour to build fonts where letters stack on top of another, but this is something for another tutorial.

PPPS : If you forgo adding marks, fontforge will try to position those glyphs by itself. If you only have a few accented letters and do not plan on redesigning them in the future, it might be easier to build the glyphs without a mark-to-base lookup. Simply open the glyphs that have been built and manually drag the diacritic into position.

 


<Part#2> - Table of Contents - <Part#4>

Posted Mar 1, 2018, 8:09 PM UTC · edited

83
Loading comments…