summarylogtreecommitdiffstats
path: root/ricty_generator.patch
blob: e910a8e78f9d650ca921339b8ba91af560a88d7d (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
--- ricty_generator.sh	2024-04-10 14:06:45.339463300 +0000
+++ ricty_nerd_generator.sh	2024-04-12 23:37:05.781117200 +0000
@@ -2,7 +2,7 @@
 
 #
 # Ricty Generator
-ricty_version="4.1.1"
+ricty_version="4.1.1; NF 3.2.1"
 #
 
 #
@@ -59,6 +59,7 @@
 # Set familyname
 ricty_familyname="Ricty"
 ricty_familyname_suffix=""
+nf_familyname_suffix="Nerd Font"
 
 # Set ascent and descent (line width parameters)
 ricty_ascent=835
@@ -160,7 +161,7 @@
             ;;
         "n" )
             echo "Option: Set fontfamily suffix: ${OPTARG}"
-            ricty_familyname_suffix=`echo $OPTARG | tr -d ' '`
+            ricty_familyname_suffix="$OPTARG"
             ;;
         "w" )
             echo "Option: Widen line space"
@@ -287,6 +288,21 @@
     trap "echo 'Abnormally terminated'; exit 3" HUP INT QUIT
 fi
 
+# Set fontname, familyname
+ricty_nf_familyname=""
+ricty_discord_nf_familyname=""
+
+if [ "${ricty_familyname_suffix}" = "" ]
+then
+    ricty_nf_familyname="${ricty_familyname} ${nf_familyname_suffix}"
+	ricty_discord_nf_familyname="${ricty_familyname} Discord ${nf_familyname_suffix}"
+else
+    ricty_nf_familyname="${ricty_familyname} ${ricty_familyname_suffix} ${nf_familyname_suffix}"
+    ricty_discord_nf_familyname="${ricty_familyname} ${ricty_familyname_suffix} Discord ${nf_familyname_suffix}"
+fi
+ricty_nf_fontname=`echo ${ricty_nf_familyname} | tr -d ' '`
+ricty_discord_nf_fontname=`echo ${ricty_discord_nf_familyname} | tr -d ' '`
+
 ########################################
 # Generate script for modified Inconsolata
 ########################################
@@ -575,15 +591,15 @@
 #!$fontforge_command -script
 
 # Print message
-Print("Generate Ricty")
+Print("Generate Ricty Nerd Font")
 
 # Set parameters
 inconsolata_list  = ["${tmpdir}/${modified_inconsolata_regular}", \\
                      "${tmpdir}/${modified_inconsolata_bold}"]
 migu1m_list       = ["${tmpdir}/${modified_migu1m_regular}", \\
                      "${tmpdir}/${modified_migu1m_bold}"]
-fontfamily        = "${ricty_familyname}"
-fontfamilysuffix  = "${ricty_familyname_suffix}"
+nffontname        = "${ricty_nf_fontname}"
+nffamilyname      = "${ricty_nf_familyname}"
 fontstyle_list    = ["Regular", "Bold"]
 fontweight_list   = [400,       700]
 panoseweight_list = [5,         8]
@@ -606,19 +622,11 @@
     Reencode("unicode")
 
     # Set configuration
-    if (fontfamilysuffix != "")
-        SetFontNames(fontfamily + fontfamilysuffix + "-" + fontstyle_list[i], \\
-                     fontfamily + " " + fontfamilysuffix, \\
-                     fontfamily + " " + fontfamilysuffix + " " + fontstyle_list[i], \\
-                     fontstyle_list[i], \\
-                     copyright, version)
-    else
-        SetFontNames(fontfamily + "-" + fontstyle_list[i], \\
-                     fontfamily, \\
-                     fontfamily + " " + fontstyle_list[i], \\
-                     fontstyle_list[i], \\
-                     copyright, version)
-    endif
+    SetFontNames(nffontname + "-" + fontstyle_list[i], \\
+                 nffamilyname, \\
+                 nffamilyname + " " + fontstyle_list[i], \\
+                 fontstyle_list[i], \\
+                 copyright, version)
     SetTTFName(0x409, 2, fontstyle_list[i])
     SetTTFName(0x409, 3, "FontForge 2.0 : " + \$fullname + " : " + Strftime("%d-%m-%Y", 0))
     ScaleToEm(860, 140)
@@ -704,13 +712,8 @@
     AutoInstr()
 
     # Save Ricty
-    if (fontfamilysuffix != "")
-        Print("Save " + fontfamily + fontfamilysuffix + "-" + fontstyle_list[i] + ".ttf")
-        Generate(fontfamily + fontfamilysuffix + "-" + fontstyle_list[i] + ".ttf", "", 0x84)
-    else
-        Print("Save " + fontfamily + "-" + fontstyle_list[i] + ".ttf")
-        Generate(fontfamily + "-" + fontstyle_list[i] + ".ttf", "", 0x84)
-    endif
+    Print("Save " + nffontname + "-" + fontstyle_list[i] + ".ttf")
+    Generate(nffontname + "-" + fontstyle_list[i] + ".ttf", "", 0x84)
     Close()
 
     i += 1
@@ -734,7 +737,7 @@
 filename = \$argv[1]
 characters = \$argv[2]
 
-Print("Generate Ricty Discord")
+Print("Generate Ricty Discord Nerd Font")
 
 # Enable all flags
 flag_quotedbl="true"
@@ -859,14 +862,16 @@
 endif
 inputfamily  = Strsub(input, 0, hyphen_index)
 inputstyle   = Strsub(input, hyphen_index + 1)
+nffontname   = "${ricty_discord_nf_fontname}"
+nffamilyname = "${ricty_discord_nf_familyname}"
 familysuffix = "Discord"
 
 # Open file and set configuration
 Open(filename)
 Reencode("unicode")
-SetFontNames(inputfamily + familysuffix + "-" + inputstyle, \
-             \$familyname + " " + familysuffix, \
-             \$familyname + " " + familysuffix + " " + inputstyle, \
+SetFontNames(nffontname + "-" + inputstyle, \\
+             nffamilyname, \\
+             nffamilyname + " " + inputstyle, \\
              inputstyle)
 SetTTFName(0x409, 3, "FontForge 2.0 : " + \$fullname + " : " + Strftime("%d-%m-%Y", 0))
 
@@ -911,7 +916,7 @@
 
 # 0 -> dotted 0 (Inconsolata's unused glyph)
 if (flag_0 == "true")
-    Select(65544);  Copy()
+    Select("zero.zero");  Copy()
     Select(0u0030); Paste()
 endif
 
@@ -983,7 +988,7 @@
 
 # r -> r of serif (Inconsolata's unused glyph)
 if (flag_r == "true")
-    Select(65542);  Copy()
+    Select("glyph22703");  Copy()
     Select(0u0072); Paste()
 endif
 
@@ -1010,8 +1015,8 @@
 endif
 
 # Save Ricty Discord
-Print("Save " + inputfamily + familysuffix + "-" + inputstyle + ".ttf")
-Generate(inputfamily + familysuffix + "-" + inputstyle + ".ttf", "", 0x84)
+Print("Save " + nffontname + "-" + inputstyle + ".ttf")
+Generate(nffontname + "-" + inputstyle + ".ttf", "", 0x84)
 Close()
 
 Quit()
@@ -1099,22 +1104,22 @@
 $fontforge_command -script ${tmpdir}/${ricty_generator} \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${ricty_discord_generator} \
-    ${ricty_familyname}${ricty_familyname_suffix}-Regular.ttf "${non_discorded_characters}" \
+    ${ricty_nf_fontname}-Regular.ttf "${non_discorded_characters}" \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${ricty_discord_generator} \
-    ${ricty_familyname}${ricty_familyname_suffix}-Bold.ttf "${non_discorded_characters}" \
+    ${ricty_nf_fontname}-Bold.ttf "${non_discorded_characters}" \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${regular2oblique_converter} \
-    ${ricty_familyname}${ricty_familyname_suffix}-Regular.ttf \
+    ${ricty_nf_fontname}-Regular.ttf \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${regular2oblique_converter} \
-    ${ricty_familyname}${ricty_familyname_suffix}-Bold.ttf \
+    ${ricty_nf_fontname}-Bold.ttf \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${regular2oblique_converter} \
-    ${ricty_familyname}${ricty_familyname_suffix}Discord-Regular.ttf \
+    ${ricty_discord_nf_fontname}-Regular.ttf \
     2> $redirection_stderr || exit 4
 $fontforge_command -script ${tmpdir}/${regular2oblique_converter} \
-    ${ricty_familyname}${ricty_familyname_suffix}Discord-Bold.ttf \
+    ${ricty_discord_nf_fontname}-Bold.ttf \
     2> $redirection_stderr || exit 4
 
 # Remove temporary directory
@@ -1125,5 +1130,5 @@
 fi
 
 # Exit
-echo "Succeeded in generating Ricty!"
+echo "Succeeded in generating Ricty Nerd Font!"
 exit 0