1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2024-12-29 10:20:40 +01:00
SubwayTooter-Android-App/dumpFont.pl

48 lines
713 B
Perl

#!perl --
use strict;
use warnings;
use Font::FreeType;
my $face = Font::FreeType->new->face('emojione_android.ttf');
my $f =0;
my $l =0;
my $n =0;
$face->foreach_char(sub{
my $codepoint = $_->char_code;
if( $codepoint < 80 ){
return;
}
if($n ==0 ){
if( $l == 0 ){
print "\tprivate static void initForFont",(++$f),"(){\n";
}
print "\t\taddFontCode(new int[]{";
}
printf "0x%x,",$codepoint;
if( ++$n >= 5 ){
$n =0;
print "});\n";
if( ++$l >= 100 ){
$l = 0;
print "\t}\n";
}
}
});
if( $n > 0 ){
print "});\n";
print "\t}\n";
}
print "\tstatic{\n";
for(my $i=1;$i<=$f;++$i){
print"\t\tinitForFont$i();\n";
}
print "\t}\n";