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...
-
Create a font project named "Font#3"
-
Tracing the glyphs
-
Download, then drag and drop this image in Inkscape.
-
Right click the image, then
Trace BitmapwithMode|Brightness cutoff {Threshold=0.600}andOptions|Supress speckels {Size=10}. Then delete the image and this is the result. -
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.
-
To do this, select the
Draw beziers toolin '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 chooseFill 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 withObject|Raise/Lower. -
Then, select one shape and the traced image and call
Path|Intersection. result -
Copy the glyph, go back with
ctrl+zand paste it to the side. result -
Repeat until you have all the glyphs : result
-
Find the ascent/descent : here
ascent = 76px, descent=0pxSetting 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|Generaluncheckscale outlineand increase either of ascent/descent without breaking your positioning. Don't forget to validateOK.
This is what I did, by extending descent to 30 afterwards.
-
-
drawing the accents
- Simply draw a few accents using the Bezier tool, here is what is should look like.
-
Setup in FontForge
-
Set ascent/descent
-
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. -
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"
-
Create the glyph for "space" of width=10.
-
-
Kern the pairs 6. Exactly like in Tutorial#2. 7. Here's the result.
-
Add the accents
-
Import them
- Copy-paste them from Inkscape like any other glyph. Here are their glyph numbers :
Grave (0x60),Acute (0xb4),Dieresis (0xa8),Circumflex (0x5e). - result
- Copy-paste them from Inkscape like any other glyph. Here are their glyph numbers :
-
Add the anchors
-
First, you need to create an anchor class.
-
Go to
Element|Font Info|Lookups|pane GPOS. From there,Add Lookup {Mark to Base Position, New->mark, Lookup Name=accents}. -
Select the lookup and
Add subtablethenOK,New Anchor Classand type in "accent" as a name thenOK. -
Now, close
Font Information windowand edit one of the accent. Right-click andAdd Anchor->Accent,mark(NOT ~~base mark~~), do this to each of the accents, and position the anchor below the accent. example -
Then, for each letter, add an anchor as a
base markthis 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).
-
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. -
Don't forget to click
OKto save your changes once you're done.
-
-
build the accented glyphs 9. Finally, select all the glyphs
ctrl+a, thenElement|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.
-
-
Generate the font
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.
Posted Mar 1, 2018, 8:09 PM UTC · edited