From 26fb8f96f7642bd0f802c02aee935bb50dbf9c72 Mon Sep 17 00:00:00 2001 From: Koichi KAMICHI Date: Sun, 21 Jan 2007 03:45:36 +0000 Subject: [PATCH] Fixed. Reformatted. --- makettf/index.html | 6 +++--- makettf/makettf.cgi | 5 +++-- makettf/makettf.pl | 56 ++++++++++++++++++++++++++++++++++----------------- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/makettf/index.html b/makettf/index.html index dada1b8..ab3e05a 100644 --- a/makettf/index.html +++ b/makettf/index.html @@ -1,5 +1,6 @@ - - + @@ -57,4 +58,3 @@ fonts.jp - diff --git a/makettf/makettf.cgi b/makettf/makettf.cgi index d412113..d259910 100755 --- a/makettf/makettf.cgi +++ b/makettf/makettf.cgi @@ -83,8 +83,9 @@ sub makepage{ print <<"EOT"; Content-type: text/html; - - + diff --git a/makettf/makettf.pl b/makettf/makettf.pl index 30a680f..1b0bfdc 100755 --- a/makettf/makettf.pl +++ b/makettf/makettf.pl @@ -29,6 +29,9 @@ unlink "$WORKDIR/$WORKNAME.scr"; unlink "$WORKDIR/$WORKNAME.ttf"; mkdir "$WORKDIR/build"; +open LOG, ">>:utf8", "$WORKDIR/$WORKNAME.log"; +select((select(LOG), $| = 1)[0]); + # initialize if(-e "$WORKDIR/$HEADER_FILENAME"){ open FH, "<:utf8", "$WORKDIR/$HEADER_FILENAME"; @@ -39,11 +42,12 @@ if(-e "$WORKDIR/$HEADER_FILENAME"){ } close FH; close FH2; + + print LOG "Prepare header file ... done.\n"; } else{ - open FH, ">>:utf8", "$WORKDIR/$WORKNAME.log"; - print FH "No header file.\n"; - close FH; + print LOG "No header file.\n"; + close LOG; exit; } @@ -57,11 +61,12 @@ if(-e "$WORKDIR/$PARTS_FILENAME"){ } close FH; $temp = $buffer; + + print LOG "Prepare parts file ... done.\n"; } else{ - open FH, ">>:utf8", "$WORKDIR/$WORKNAME.log"; - print FH "No parts file.\n"; - close FH; + print LOG "No parts file.\n"; + close LOG; exit; } @temp = split(/\r\n|\r|\n/, $temp); @@ -71,8 +76,9 @@ foreach(@temp){ $buhin{$temp2[0]} = $temp2[1]; } } +print LOG "Prepare parts data ... done.\n"; -# parse target codepoint +# parse target code point %target = (); foreach(sort(keys %buhin)){ if($_ =~ m/^\[([^\]])\]$/){ @@ -88,11 +94,14 @@ foreach(sort(keys %buhin)){ $name = $_; $target{$target} = $name; } +print LOG "Prepare target code point ... done.\n"; # make glyph for each target +print LOG "Prepare each glyph.\n"; foreach(sort(keys(%target))){ $code = $_; - $target = $target{$_}; + print LOG "$code : "; + $target = $target{$code}; %subset = (); &addsubset($target); $partsdata = ""; @@ -106,11 +115,13 @@ foreach(sort(keys(%target))){ $partsdata =~ s/([^0-9A-Za-z_ ])/'%'.unpack('H2',$1)/ge; $partsdata =~ s/\s/+/g; $svg = `$MAKEGLYPH $target $partsdata $SHOTAI $WEIGHT`; + print LOG "$MAKEGLYPH $target $partsdata $SHOTAI $WEIGHT\n"; open FH, ">$WORKDIR/build/$code.svg"; print FH $svg; close FH; &addglyph($code); } +print LOG "Prepare each glyph ... done.\n"; # scripts footer if(-e "$WORKDIR/$FOOTER_FILENAME"){ @@ -122,18 +133,22 @@ if(-e "$WORKDIR/$FOOTER_FILENAME"){ } close FH; close FH2; + + print LOG "Prepare footer file ... done.\n"; } else{ - open FH, ">>:utf8", "$WORKDIR/$WORKNAME.log"; - print FH "No footer file.\n"; - close FH; + print LOG "No footer file.\n"; + close LOG; exit; } +close LOG; &makefont; +############################################################################## + sub addglyph{ - my $buffer =<<"EOT"; + my $buffer =<<"EOT"; Print(0u$_[0]) Select(0u$_[0]) Clear() @@ -152,23 +167,28 @@ EOT close FH; } +############################################################################## + sub makefont{ - my $buffer = "Generate(\"$WORKDIR/$TEMPNAME.ttf\", \"\", 0)\n"; + my $buffer = "Generate(\"$WORKDIR/$WORKNAME.ttf\", \"\", 0)\n"; $buffer .= "Quit()\n"; open FH, ">>:utf8", "$WORKDIR/$WORKNAME.scr"; print FH $buffer; close FH; - $buffer = `$FONTFORGE -script $WORKDIR/$WORKNAME.scr > $WORKDIR/$WORKNAME.log 2>&1`; - $buffer = `$MV $WORKDIR/$TEMPNAME.ttf $WORKDIR/$WORKNAME.ttf`; + $buffer = `export LANG=utf-8; $FONTFORGE -script $WORKDIR/$WORKNAME.scr >> $WORKDIR/$WORKNAME.log 2>&1`; } +############################################################################## + sub addsubset{ $subset{$_[0]} = $buhin{$_[0]}; - while($buhin{$_[0]} =~ m/(^|\$)99:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:(.+?)(\$|$)/gc){ - if(!exists($subset{$2})){ - &addsubset($2); + my $buffer = '$'.$buhin{$_[0]}.'$'; + while($buffer =~ m/\$99:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^\$]*)/gc){ + if(!exists($subset{$1})){ + &addsubset($1); } } } +############################################################################## -- 1.7.10.4