README.md 3.45 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

svilayphiou's avatar
svilayphiou committed
17
### Image
18

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

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

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

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





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

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



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

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.

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



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

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

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

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

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



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

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

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



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


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


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


78
Save as a .bmp file.
svilayphiou's avatar
svilayphiou committed
79

80

81
### GlyphTracer
82

83
84
85
- 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.
86
87
88



89
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.
90
91


92
93
94
95
96
97
98
99
100
101
102
103
104
### 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].
105

106
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
107

108
   python mergeSpacing.py font.otf original-font.otf spaced-font.otf
svilayphiou's avatar
svilayphiou committed
109
110
111
112



Troubleshooting
113
---------------
svilayphiou's avatar
svilayphiou committed
114

115
116
117
### 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
118

119
120
### 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
121
122


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