forked from sunaku/tamzen-font
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
33 lines (30 loc) · 793 Bytes
/
Rakefile
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
require 'rake/clean'
fonts_dir = 'fonts.dir'
file fonts_dir => 'Tamzen.rb' do |t|
ruby t.prerequisites[0]
sh 'mkfontdir'
sh 'xset', '+fp', Dir.pwd
sh 'xset', 'fp', 'rehash'
end
CLOBBER.include '*.bdf', fonts_dir
rule '.png' => ['.bdf', fonts_dir] do |t|
@bdf_to_x11 ||= Hash[File.readlines(fonts_dir).map(&:split)]
sh 'convert',
'-font', @bdf_to_x11[t.source],
'label:' + [
'ABCDEFGHIJKLMNOPQRSTUVWXYZ 12345',
'abcdefghijklmnopqrstuvwxyz 67890',
'{}[]()<>$*-+=/#_\%^@\\\\&|~?\'"`!,.;:',
"Illegal1i = oO0 #{t.source}",
].join("\n"),
'-bordercolor', 'white',
'-border', '5',
'-strip',
t.name
end
CLEAN.include '*.png'
task :default => fonts_dir do
for png in FileList['*.bdf'].ext('png')
Rake::Task[png].invoke
end
end