#!/usr/bin/perl
#
# usage: ttfls ttf
#
# display a ttf directory.
#
#	2002/2/3, by 1@2ch
#	* public domain *
#

require 'lib_ttfdir.pl';

if (0 == @ARGV) {
    print "usage: $0 ttffile\n";
    exit 1;
}

foreach $ttf (@ARGV) {
    ropen($ttf);
    ttf_readdir_from_ttf();
    rclose();

    printf "0x%08lx '%s'\n", unpack('N',$ttf_font_type), $ttf_font_type;
    print "TYPE        SIZE            OFFSET             SUM\n";
    foreach my $t (@ttf_fontdir_types) {
	printf "%s\t%8ld\t0x%08lx\t0x%08lx\n", 
	$t,
	$ttf_fontdir_length{$t},
	$ttf_fontdir_offset{$t},
	$ttf_fontdir_sum{$t};
    }
}
