README.md 3.92 KB
Newer Older
1
2
3
4
FONS
====
A tool to make fonts out of bitmap images.

5
6
7
8
9
10
11
12
13
Tools needed
------------
- Gimp
- Gimp G'MIC plugin
- Autotrace
- Fontforge with Autotrace



14
Process
svilayphiou's avatar
svilayphiou committed
15
-------
16

17
18
### Preparing the image

19

svilayphiou's avatar
svilayphiou committed
20
#### Get a bitmap image of characters (crop unnecessary white parts for a faster process, you can use Gimp's automatic crop for that).
21

22
![](http://osp.kitchen/api/osp.tools.fons/raw/input/scan_bitmap.jpg)
23
24
:    A scan in bitmap

25
![](http://osp.kitchen/api/osp.tools.fons/raw/input/scan_gray_1200dpi.jpg)
26
27
:    A scan in gray levels

28
![](http://osp.kitchen/api/osp.tools.fons/raw/input/rasterized_ospDIN.png)
29
30
31
32
33
34
:    A rasterized font





svilayphiou's avatar
svilayphiou committed
35
#### Levels (have a white background, black characters but still shades of gray)
36

37
![](http://osp.kitchen/api/osp.tools.fons/raw/documentation/01-bitmap_levels.png)
38
39
40



svilayphiou's avatar
svilayphiou committed
41
#### Small boost 
42
43
44

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.

45
![](http://osp.kitchen/api/osp.tools.fons/raw/documentation/02-scale-254percent.png)
46
47
48



svilayphiou's avatar
svilayphiou committed
49
#### Sharpen with "Unsharp mask"
50
51
52

Put the amount to the maximum and then search for the point where you don't see 

53
![bad](http://osp.kitchen/api/osp.tools.fons/raw/documentation/03-sharpen-too_few.png)
54
55
:    Radius too small

56
![ok](http://osp.kitchen/api/osp.tools.fons/raw/documentation/03-sharpen-ok.png)
57

58
![bad](http://osp.kitchen/api/osp.tools.fons/raw/documentation/03-sharpen-too_much.png)
59
60
61



svilayphiou's avatar
svilayphiou committed
62
#### Big boost
63

64
65
Scale up to 403% (check on notebook or with PierreH if it's enough)

66
![](http://osp.kitchen/api/osp.tools.fons/raw/documentation/04-big_boost.png)
67
68
69



svilayphiou's avatar
svilayphiou committed
70
71
72
#### Threshold


73
![bad](http://osp.kitchen/api/osp.tools.fons/raw/documentation/05-threshold-bad.png)
74
75


76
![ok](http://osp.kitchen/api/osp.tools.fons/raw/documentation/05-threshold-ok.png)
svilayphiou's avatar
svilayphiou committed
77
78


79
80
81
82
83
84
85
86
87
88
89
#### Baseline

When importing a bitmap, Fontforge scales up/down the bitmap so that it fits into the glyph box. If we use GlyphTracer 1.4, this ends up with different scales of glyphs. In order to prevent this, we can put a black rectangle of the height of the maximum ascendant and maximum descendant.

![baseline](http://osp.kitchen/api/osp.tools.fons/raw/documentation/06-baseline.png)


#### Bitmap

- Change the color mode to Indexed mode with 1 black/white bit.
- Save as a .bmp file.
svilayphiou's avatar
svilayphiou committed
90

91

92
### GlyphTracer
93

94
95
96
- Launch GlyphTracer and feed in the .bmp image (otherwise it will complain).
- For each given glyph, click on the letter you want to use.
- Change the characters subset in the bottom left dropdown menu to select more glyphs.
97
98
99



100
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.
101
102


103
104
105
106
107
108
109
110
111
112
113
114
115
### Merging fonts

In case you want to complete an existing font, you can use the script `mergeFonts.py`.

    python mergeFonts.py 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)[https://github.com/hodefoting/kernagic].
116

117
But if you want to get back metric and kerning data from an existing font, you can use the script `mergeSpacing.py`. It can be any font format than `.otf`.
svilayphiou's avatar
svilayphiou committed
118

119
   python mergeSpacing.py font.otf original-font.otf spaced-font.otf
svilayphiou's avatar
svilayphiou committed
120
121
122
123



Troubleshooting
124
---------------
svilayphiou's avatar
svilayphiou committed
125

126
127
128
### 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 `mergeFonts.py`.

svilayphiou's avatar
svilayphiou committed
129

130
131
### I have empty and very small width when I open a glyph in Fontforge.
You probably generated the .sfd with a zoom level different than 1.
svilayphiou's avatar
svilayphiou committed
132
133


134
135
### I see several letters in ony glyph.
You probably generated the .sfd with a zoom level different than 1.