-
Notifications
You must be signed in to change notification settings - Fork 5
/
spaces_dashes.ff
90 lines (84 loc) · 2.37 KB
/
spaces_dashes.ff
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright (C) 2008-2010, 2012, 2014 Andrey V. Panov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
# This fontforge script proposed for making spaces and dashes
#italic_angle=$italicangle
pi=4.0*ATan2(1.0,1.0)
tan_it = 1.0*Tan($italicangle*pi/180.0)
Reencode("unicode")
# spaces
#Select("space")
#CopyReference()
#Select("nonbreakingspace")
#Paste()
dub_glyph.ff("space","nonbreakingspace")
dub_glyph.ff("hyphen","softhyphen")
Select("emdash")
width = GlyphInfo("Width")
Select("uni2003") # em space
SelectMore("uni2001") # em quad
SetWidth(width)
Select("uni2002") # en space
SelectMore("uni2000") # en quad
SetWidth(Round(width/2.0))
Select("uni2004") # 1/3 em space
SetWidth(Round(width/3.0))
Select("uni2005")
SetWidth(Round(width/4.0))
Select("uni2006")
SetWidth(Round(width/6.0))
Select("uni2009")
SetWidth(Round(width/5.0))
# Hair space
# Cambria and Lucida use emdash/18
# TNR and Arial - emdash/12
# Droid and Dejavu - emdash/10
Select("uni200A")
SetWidth(Round(width/18.0))
# MEDIUM MATHEMATICAL SPACE
Select(0u205F)
SetWidth(Round(width*2.0/9.0))
# Select("uni200B","uni200D")
# SetWidth(0)
# Select("A")
# width = -GlyphInfo("Kern","C") # Thinest kerning pair
# if (width > 0)
# Select("uni200A")
# SetWidth(width)
# endif
Select("zero")
width = GlyphInfo("Width")
Select("uni2007") # figure space
SetWidth(width)
Select("endash")
width1 = GlyphInfo("Width")
if (width1 == width)
dub_glyph.ff("endash","figuredash")
endif
dub_glyph.ff("hyphen",0u2010)
dub_glyph.ff("hyphen",0u2011)
Select("period")
width = GlyphInfo("Width")
Select("uni2008") # punctuation space
SetWidth(width)
# NARROW NO-BREAK SPACE
dub_glyph.ff(0u2009,0u202F)
# format zero width characters
Select(0u200B,0u200F)
SelectMore(0u2028,0u202E)
SelectMore(0u2060,0u206F)
SetWidth(0)
Reencode("unicode")