Commit 0b35b04f authored by svilayphiou's avatar svilayphiou
Browse files

A new script to merge metrics and kerning data from an existing font.

parent bc8362ff
......@@ -18,26 +18,13 @@ Process
#### Get a bitmap image of characters (crop unnecessary white parts for a faster process, you can use Gimp's automatic crop for that).
: A scan in bitmap
: A scan in gray levels
: A rasterized font
......@@ -46,8 +33,7 @@
#### Levels (have a white background, black characters but still shades of gray)
......@@ -55,8 +41,7 @@
Scale up the image to something like 254% with the "Sinc (Lanczos 3)" algorithm. We choose on purpose a non-round number of scaling to break the bitmap patterns.
......@@ -64,15 +49,12 @@
Put the amount to the maximum and then search for the point where you don't see
: Radius too small
......@@ -80,20 +62,17 @@
Scale up to 403% (check on notebook or with PierreH if it's enough)
#### Threshold
Save as a .bmp file.
......@@ -110,13 +89,28 @@ Save as a .bmp file.
IMPORTANT: If you zoom out to select the letters, don't forget to go back to zoom 1 before generating the font file. Don't close GlyphTracer before checking the .sfd file, then you can export again if you forgot to zoom back in.
### Merging fonts
In case you want to complete an existing font, you can use the script ``.
python fonte1.ufo fonte2.ufo ... fonte17.ufo fonte-out.ufo
### Metrics and kernings
A big part of type design is about managing the white space around the letters (metrics) and exceptions for specific couples of letters (kernings).
- For the metrics, we make an auto-spacing while generating the .sfd file with GlyphTracer.
- For the kernings, you can try the tool (Kernagic)[].
But if you want to get back metric and kerning data from an existing font, you can use the script ``. It can be any font format than `.otf`.
python font.otf original-font.otf spaced-font.otf
### My image is too big to manipulate it.
Split it into several images and generate several .sfd files. Then you can merge the fonts with the script ``.
#! /usr/bin/python
Merges the spacing information from one base font to your font and produces a new font (keeping the original fonts intact).
It can take any font format that Fontforge can open: .ufo, .otf, .sfd...
python MyFont.ufo BaseFont.ufo SpacedFont.ufo
import fontforge
import sys
font =[1])
original =[2])
for g in font.glyphs():
char = g.glyphname
# Gets original font bearings
left = original[char].left_side_bearing
right = original[char].right_side_bearing
# Sets current bearings to 0
font[char].left_side_bearing = 0
font[char].right_side_bearing = 0
# Gets drawing width
width = font[char].width
# Resize the width with original bearings
font[char].width = left + width + right
font[char].left_side_bearing = left
font[char].right_side_bearing = right
afm = original.generate("%s.pfa" % sys.argv[2])
# MERGE OPENTYPE FEATURES (including kernings)
font.mergeFeature("%s.afm" % sys.argv[2])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment