#!/usr/bin/env perl
# Copyright (C) 2012 Zvi Gilboa (zgilboa@virginia.edu)
# This script is hereby released to the public domain.
# You may use or modify it at your own risk in any way you see fit.
use strict;
use warnings;

my %glyph_unicode_values;
my %glyph_names;

open (FontGlyphs, $ARGV[0]);

while (<FontGlyphs>) {
  chomp;
  my ($glyph_unicode, $glyph_name) = split (" , ", $_); # account for python's "soft" spaces
  $glyph_unicode_values{$glyph_name} = $glyph_unicode;
  $glyph_names{$glyph_unicode} = $glyph_name;
}

my @sorted = sort {
  $glyph_unicode_values{$a} <=> $glyph_unicode_values{$b}
} keys %glyph_unicode_values;

for my $glyph_name (@sorted) {
  print "$glyph_unicode_values{$glyph_name}: $glyph_name\n";
}

close (FontGlyphs);
