exclude fonts from the zip file that are larger than the maximum size we can

load with this firmware


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5011 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2004-08-24 09:38:26 +00:00
parent e8cad94e3c
commit c4d463bd7c

View file

@ -1,5 +1,13 @@
#!/usr/bin/perl #!/usr/bin/perl
sub filesize {
my ($filename)=@_;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
return $size;
}
sub buildlangs { sub buildlangs {
my ($outputlang)=@_; my ($outputlang)=@_;
my $dir = "../apps/lang"; my $dir = "../apps/lang";
@ -54,6 +62,16 @@ sub buildzip {
my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR); my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR);
closedir DIR; closedir DIR;
my $maxfont;
open(HEADER, "<../firmware/export/font.h");
while(<HEADER>) {
if(/^\#define MAX_FONT_SIZE[ \t]*(\d+)/) {
$maxfont = $1;
}
}
close(HEADER);
die "no decent max font size" if ($maxfont < 2000);
for(@fonts) { for(@fonts) {
my $f = $_; my $f = $_;
@ -63,6 +81,14 @@ sub buildzip {
my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1"; my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1";
print "CMD: $cmd\n" if($verbose); print "CMD: $cmd\n" if($verbose);
`$cmd`; `$cmd`;
# no need to add fonts we cannot load anyway
my $fontsize = filesize(".rockbox/fonts/$o");
print STDERR "$maxfont $fontsize $o\n";
if($fontsize > $maxfont) {
print STDERR "unlink\n";
unlink(".rockbox/fonts/$o");
}
} }
if($image) { if($image) {