105 0x1f310, // globe with meridians (Symbola font) |
105 0x1f310, // globe with meridians (Symbola font) |
106 0x1f4d3, // notebook (Symbola font) |
106 0x1f4d3, // notebook (Symbola font) |
107 0x1f5c0, // folder (Symbola font) |
107 0x1f5c0, // folder (Symbola font) |
108 0x1f5cf, // page (Symbola font) |
108 0x1f5cf, // page (Symbola font) |
109 ) |
109 ) |
|
110 |
|
111 val vacuous_font: Seq[Int] = |
|
112 Seq(0x3c) // "<" as template |
110 } |
113 } |
111 |
114 |
112 |
115 |
113 /* font families */ |
116 /* font families */ |
114 |
117 |
185 Isabelle_System.mkdirs(target_dir) |
190 Isabelle_System.mkdirs(target_dir) |
186 |
191 |
187 val font_dirs = source_dirs ::: List(Path.explode("~~/Admin/isabelle_fonts")) |
192 val font_dirs = source_dirs ::: List(Path.explode("~~/Admin/isabelle_fonts")) |
188 for (dir <- font_dirs if !dir.is_dir) error("Bad source directory: " + dir) |
193 for (dir <- font_dirs if !dir.is_dir) error("Bad source directory: " + dir) |
189 |
194 |
190 for { source <- sources; (source_font, index) <- source.fonts.zipWithIndex } { |
195 |
191 val isabelle_file = find_file(font_dirs, Family.isabelle_text.get(index)) |
196 // Isabelle fonts |
192 |
197 |
193 val source_file = find_file(font_dirs, source_font) |
198 val targets = |
194 val source_names = Fontforge.font_names(source_file) |
199 for { source <- sources; (source_font, index) <- source.fonts.zipWithIndex } |
195 |
200 yield { |
196 val target_names = source_names.update(prefix = target_prefix, version = target_version) |
201 val isabelle_file = find_file(font_dirs, Family.isabelle_text.get(index)) |
|
202 |
|
203 val source_file = find_file(font_dirs, source_font) |
|
204 val source_names = Fontforge.font_names(source_file) |
|
205 |
|
206 val target_names = source_names.update(prefix = target_prefix, version = target_version) |
|
207 val target_file = target_dir + target_names.ttf |
|
208 |
|
209 progress.echo("Creating " + target_file.toString + " ...") |
|
210 Fontforge.execute( |
|
211 Fontforge.commands( |
|
212 Fontforge.open(isabelle_file), |
|
213 Fontforge.select(Range.isabelle_font), |
|
214 Fontforge.copy, |
|
215 Fontforge.close, |
|
216 |
|
217 Fontforge.open(source_file), |
|
218 Fontforge.select(Range.base_font), |
|
219 Fontforge.select_invert, |
|
220 Fontforge.clear, |
|
221 Fontforge.select(Range.isabelle_font), |
|
222 Fontforge.paste, |
|
223 |
|
224 target_names.set, |
|
225 Fontforge.generate(target_file), |
|
226 Fontforge.close) |
|
227 ).check |
|
228 |
|
229 (target_file, index) |
|
230 } |
|
231 |
|
232 |
|
233 // Vacuous font |
|
234 |
|
235 { |
|
236 val vacuous_file = find_file(font_dirs, Family.vacuous.get(0)) |
|
237 |
|
238 val target_names = Fontforge.font_names(vacuous_file) |
197 val target_file = target_dir + target_names.ttf |
239 val target_file = target_dir + target_names.ttf |
198 |
240 |
199 progress.echo("Creating " + target_file.toString + " ...") |
241 progress.echo("Creating " + target_file.toString + " ...") |
|
242 |
|
243 val domain = |
|
244 (for ((target_file, index) <- targets if index == 0) |
|
245 yield Fontforge.font_domain(target_file)).flatten.toSet.toList.sorted |
|
246 |
200 Fontforge.execute( |
247 Fontforge.execute( |
201 Fontforge.commands( |
248 Fontforge.commands( |
202 Fontforge.open(isabelle_file), |
249 Fontforge.open(vacuous_file), |
203 Fontforge.select(Range.isabelle_font), |
250 Fontforge.select(Range.vacuous_font), |
204 Fontforge.copy, |
251 Fontforge.copy) + |
205 Fontforge.close, |
252 |
206 |
253 domain.map(code => |
207 Fontforge.open(source_file), |
254 Fontforge.commands( |
208 Fontforge.select(Range.base_font), |
255 Fontforge.select(Seq(code)), |
209 Fontforge.select_invert, |
256 Fontforge.paste)) |
210 Fontforge.clear, |
257 .mkString("\n", "\n", "\n") + |
211 Fontforge.select(Range.isabelle_font), |
258 |
212 Fontforge.paste, |
259 Fontforge.commands( |
213 |
|
214 target_names.set, |
|
215 Fontforge.generate(target_file), |
260 Fontforge.generate(target_file), |
216 Fontforge.close) |
261 Fontforge.close) |
217 ).check |
262 ).check |
218 } |
263 } |
219 } |
264 } |