public
Description: Scripts for generating posters that contain glyphs of every printable character in Unicode 5.1.0
Homepage: http://mythic-beasts.com/~mark/random/unicode-poster/
Clone URL: git://github.com/mhl/unicode-poster.git
unicode-poster / copy-characters-to-webspace
100755 33 lines (23 sloc) 0.692 kb
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
#!/usr/bin/ruby -w
 
require 'yaml'
 
if ARGV.length != 2
  puts "Usage: CORRECTED-CODEPOINTS-FILE DESTINATION-DIRECTORY"
  exit(-1)
end
 
codepoints_filename = ARGV[0]
destination_directory = ARGV[1]
 
data = open(codepoints_filename,"r") { |f| YAML.load(f.read) }
 
data.each do |e|
 
  name = e[0]
  codepoint = e[1]
  
  new_name = sprintf("0x%06X.png",codepoint)
 
  puts "Copying #{name} to #{new_name}"
 
  unless system( "convert",
                 "-scale",
                 "50%",
                 "individual-characters/" + name.gsub(".png","-top.png"),
                 destination_directory + "reduced-" + new_name )
    puts "Failed to convert and copy: #{name}"
    exit(-1)
  end
end