From 446985c2aac39852bcd69938f89a978446bccee7 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Mon, 23 May 2011 02:56:28 +0200 Subject: [PATCH] fix raw encoding for single chars don't die if i want unknown chars from .bdf --- tools/makefont.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/makefont.pl b/tools/makefont.pl index d31ab97..f6c7cfd 100755 --- a/tools/makefont.pl +++ b/tools/makefont.pl @@ -164,14 +164,15 @@ for (0..$#charlist){ $c1size+=3; $c2size+=1; + my $oneraw; # If encoding is bigger, fall back to original char if($#enc>$#raw+3){ warn "Compression failure: Encoding char $char raw.\n"; - $raw=1; + $oneraw=1; }; # Generate C source - if($raw){ + if($raw||$oneraw){ $c2size-=scalar(@enc); @enc=(255,$preblank,$postblank,@raw); $c2size+=scalar(@enc); @@ -501,6 +502,7 @@ sub getfontname { ###################################################################### our $bdf; our %chars; +our $fallback; sub init_bdf{ ($title,$licence)=($font,""); my($bb); @@ -517,6 +519,7 @@ sub init_bdf{ /^COPYRIGHT "(.*)"/ && do {$licence=$1;}; /^FAMILY_NAME "(.*)"/ && do {$title=$1;}; /^FONTBOUNDINGBOX (\d+) (\d+)/ && do {$bb="$1x$2";}; + /^DEFAULT_CHAR (\d+)/ && do {$fallback=$1;}; last if /^ENDPROPERTIES/; }; @@ -577,8 +580,10 @@ sub init_bdf{ sub render_bdf{ my $ccode=$charlist[shift]; +# print "Char: $ccode:\n"; + $ccode=$fallback if !defined $chars{$ccode}; my $tchar=$chars{$ccode}; -# print "Char: $ccode:\n",join("\n",@{$tchar}),"\nEND\n"; +# print join("\n",@{$tchar}),"\nEND\n"; return @{$tchar}; };