-
Notifications
You must be signed in to change notification settings - Fork 72
/
generate_derived.pe
executable file
·73 lines (62 loc) · 2.56 KB
/
generate_derived.pe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env fontforge
build = "build/"
type_sample = "Aa0123 🮘🮘 🮙🮙 🮕🮕 🮖🮖 ◢◤◢◤┌─┬┐╔═╦╗"
Open("3270_HQ.sfd")
# Force fixed width
SelectAll()
SetWidth(1080)
# Remove IP encumbered characters
Select("uniE0FF")
SelectMore("uniF0FF")
DetachAndRemoveGlyphs()
# Generate unencumbered version for "source" distribution
Save(build + "3270_HQ_unencumbered.sfd")
# Unlink all references prior to generating derived fonts
SelectAll()
UnlinkReference()
# Remove UC 13 running man and pointing finger building helpers that are too wide
Select("full_running_man")
SelectMore("full_pointing_finger")
DetachAndRemoveGlyphs()
Reencode("compacted")
# From https://fontforge.org/docs/scripting/scripting-alpha.html#Generate
# fmflags&2 => generate a pfm file
# fmflags&0x80 => generate tables so the font will work on both Apple and MS platforms.
# fmflags&0x100 => generate a glyph map file (GID=>glyph name, unicode map). The map file will have extension “.g2n”.
# fmflags&0x200000 => round postscript coordinates
otf_flags = 0x80 | 0x100 | 0x200000
pfm_flags = 0x2
Generate(build + "3270-Regular.otf", "", otf_flags)
Generate(build + "3270-Regular.ttf")
Generate(build + "3270-Regular.pfm", "", pfm_flags)
Generate(build + "3270-Regular.woff")
Generate(build + "3270-Regular.svg")
# Make an image with the TTF version
FontImage(build + "3270-Regular.png", [20, type_sample])
SelectAll()
Scale(90, 100, 0, 0) # Scales the glyphs to 90% of 1080 = 972
SetWidth(972)
RoundToInt()
AddExtrema()
SetFontNames("3270SemiCondensed", "IBM 3270 Semi-Condensed", "IBM 3270 Semi-Condensed")
Generate(build + "3270SemiCondensed-Regular.otf", "", otf_flags)
Generate(build + "3270SemiCondensed-Regular.ttf")
Generate(build + "3270SemiCondensed-Regular.pfm", "", pfm_flags)
Generate(build + "3270SemiCondensed-Regular.woff")
Generate(build + "3270SemiCondensed-Regular.svg")
Save(build + "3270_HQ_SemiCondensed.sfd")
FontImage(build + "3270-SemiCondensed.png", [20, type_sample])
SelectAll()
Scale(90, 100, 0, 0) # 90% of 972 = 874
SetWidth(874)
RoundToInt()
AddExtrema(1) # Force extrema to be added even if close to other points
SetFontNames("3270Condensed", "IBM 3270 Condensed", "IBM 3270 Condensed")
SetMacStyle("Condensed")
Generate(build + "3270Condensed-Regular.otf", "", otf_flags)
Generate(build + "3270Condensed-Regular.ttf")
Generate(build + "3270Condensed-Regular.pfm", "", pfm_flags)
Generate(build + "3270Condensed-Regular.woff")
Generate(build + "3270Condensed-Regular.svg")
Save(build + "3270_HQ_Condensed.sfd")
FontImage(build + "3270-Condensed.png", [20, type_sample])