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 / test-codepoints
100755 48 lines (31 sloc) 0.823 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/ruby -w
 
# This script will find the codepoints which are out
# of order - this indicates that there was an error
# in the OCR and you should correct these errors by
# hand.
 
require 'yaml'
 
filename = nil
 
if ARGV.length == 0
  filename = "individual-characters/non-blank/codepoints.yaml"
elsif ARGV.length == 1
  filename = ARGV[0]
else
  puts "Usage: ./test-codepoints [ FILENAME ]"
  exit(-1)
end
 
a = open(filename,"r") { |f| YAML.load(f.read) }
 
last_codepoint = 0
 
a.each do |e|
 
  name = e[0]
  codepoint = e[1]
 
  if codepoint.class == Fixnum
 
    if codepoint < last_codepoint
      puts "Problem with: #{name} => #{codepoint}"
      puts " Out of order..."
    end
 
    last_codepoint = codepoint
 
  else
   
    puts "Problem with: #{name} => #{codepoint}"
    puts " Not a Fixnum"
 
  end
 
end