diff options
Diffstat (limited to 'Master/texmf-dist/doc/fonts/accfonts/mkt1font')
-rwxr-xr-x | Master/texmf-dist/doc/fonts/accfonts/mkt1font | 88 |
1 files changed, 56 insertions, 32 deletions
diff --git a/Master/texmf-dist/doc/fonts/accfonts/mkt1font b/Master/texmf-dist/doc/fonts/accfonts/mkt1font index c092673cb3f..a82e9181437 100755 --- a/Master/texmf-dist/doc/fonts/accfonts/mkt1font +++ b/Master/texmf-dist/doc/fonts/accfonts/mkt1font @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -$version = 0.23; +$version = 0.24; #-----------------------------------------------------------------------------# $description = "Syntax: mkt1font -n fontname -d definition-file -a afm-file -f font-file @@ -181,13 +181,13 @@ while (<AFM>) { # # Encoded chars # - if (/(^C (\d+) ; WX \d+ ; N ([a-zA-Z]+|\.notdef) ; B .* ;( L .* ;)?)\r?$/) { + if (/(^C (\d+) ; WX \d+ ; N ([a-zA-Z_][a-zA-Z0-9_.]*|\.notdef) ; B .* ;( L .* ;)?)\r?$/) { $metrics_enc[$2] = "$1\n"; } # # Unencoded chars # - elsif (/(^C -1 ; WX \d+ ; N ([a-zA-Z]+|\.notdef) ; B .* ;( L .* ;)?)\r?$/) { + elsif (/(^C -1 ; WX \d+ ; N ([a-zA-Z_][a-zA-Z0-9_.]*|\.notdef) ; B .* ;( L .* ;)?)\r?$/) { $metrics_unenc .= "$1\n"; } # @@ -269,7 +269,7 @@ while (<DIS>) { # Store character definitions in %chstrings # $l = $_ = <DIS>; - if (/^\/([a-zA-Z]+|\.notdef|\.null) {$/) { + if (/^\/([a-zA-Z_][a-zA-Z0-9_.]*|\.notdef|\.null) {$/) { $chname = $1; $chdef = $_; do { @@ -284,19 +284,18 @@ while (<DIS>) { $chdef =~ s/^(\t})($rend|$renp)$/$1 $2/m; $chstrings{$chname} = $chdef; } - until ($l !~ /^\/([a-zA-Z]+|\.notdef|\.null) {$/); - next; - } - # - # File tail - # - if (/^end$/) { - $distail = $_; - do { - $_ = <DIS>; - $distail .= $_; + until ($l !~ /^\/([a-zA-Z_][a-zA-Z0-9_.]*|\.notdef|\.null) {$/); + # + # File tail + # + if (/^end/) { + $distail = $_; + do { + $_ = <DIS>; + $distail .= $_; + } + until eof(DIS); } - until eof(DIS); } } close DIS; @@ -327,6 +326,25 @@ $v2 = $capheight - $xheight; # vertical offset for accented caps etc # $itadj = sin($italangle * 3.14159 / 180) / cos($italangle * 3.14159 / 180); +################# +# Create dotlessj +################# +# +$chstrings{dotlessj} = $chstrings{j} . "\n"; +$chstrings{dotlessj} =~ /\A(.*?)(\t[-0-9 ]+?[rvh]moveto)(.*?closepath)(.*?(-?\d+) [rv]moveto.*?closepath)(.*?)\Z/ms; +($one, $two, $three, $four, $five, $six) = ($1, $2, $3, $4, $5, $6); +if ($five > 0) { $chstrings{dotlessj} = $one . $two . $three . $six } +else { + findend("j1", ($two . $three)); + $j1end = "\t$hend{j1} $vend{j1} rmoveto"; + $chstrings{dotlessj} = $one . $j1end . $four . $six +} +$chstrings{dotlessj} =~s/\A\/j /\/dotlessj /m; +$chdefsnum += 1; +getcharinfo("j"); +getcharinfo("dotlessi"); +$metrics_unenc .= "C -1 ; WX $chwd{j} ; N dotlessj ; B $chls{j} $chdp{j} $chrs{j} $chht{dotlessi} ;\n"; + ###################### # Build the characters ###################### @@ -335,7 +353,7 @@ $itadj = sin($italangle * 3.14159 / 180) / cos($italangle * 3.14159 / 180); # First build a list of definitions supplied by user # for (@deflines) { - if (/^\s*(\d+|0[0-7]+|0x[0-9a-fA-F]+)\s+([a-zA-Z]+?|\.notdef)(?:\s+([a-zA-Z]+))?$/) { + if (/^\s*(\d+|0[0-7]+|0x[0-9a-fA-F]+)\s+([a-zA-Z_][a-zA-Z0-9_.]*?|\.notdef)(?:\s+([a-zA-Z_][a-zA-Z0-9_.]*))?$/) { ($num, $char, $acc) = ($1, $2, $3); $num = oct $num if $num =~ /^0/; if ($num > 255) { die "Bad definition (number out of range): $_\n" } @@ -477,7 +495,7 @@ while (@defs) { # open OUTAFM, ">$opt_n.afm"; foreach (@metrics_enc) { # Avoid duplicate entries - ($chname) = /( ; N [a-zA-Z]+ ; )/; + ($chname) = /( ; N [a-zA-Z_][a-zA-Z0-9_.]* ; )/; $metrics_unenc =~ s/^C -1 .*$chname.*\n//gm if $chname; } $chmetricnum = split(/\n/, $metrics_unenc); @@ -490,7 +508,7 @@ for $i (0 .. 255) { $line = $metrics_enc[$i]; if ($line) { print OUTAFM $line; - if ($line =~ /^C \d+ ; WX \d+ ; N ([a-zA-Z]*) ; /) { + if ($line =~ /^C \d+ ; WX \d+ ; N ([a-zA-Z_][a-zA-Z0-9_.]*) ; /) { $encoding .= "dup $i /$1 put\n"; } } @@ -530,17 +548,17 @@ $disbanner .= "% Command line: $cmdline"; open DIS, $disfile1; while (<DIS>) { # get header s/^(%!.*: ).*$/$1$opt_n\n$disbanner/; - s/^(\/FullName \().*(\).*)$/$1$opt_n$2/; - s/^(\/FamilyName \().*(\).*)$/$1$famname$2/; - s/^(\/FontName \/).*?( .*)$/$1$opt_n$2/; - s/^(\/FontBBox {-?\d+ )-?\d+ -?\d+ -?\d+/$1$maxdp $maxrs $maxht/m; + s/(\/FullName \().*(\).*)$/$1$opt_n$2/; + s/(\/FamilyName \().*(\).*)$/$1$famname$2/; + s/(\/FontName \/).*?( .*)$/$1$opt_n$2/; + s/(\/FontBBox {-?\d+ )-?\d+ -?\d+ -?\d+/$1$maxdp $maxrs $maxht/m; if (/^\/Encoding /) { print OUTDIS $encoding; next; } - next if (/^\/UniqueID .*$/); - s /^(\/BlueValues \[.*)(\] def)$/$1 $accheight $accheight$2/; - if (/^(\/Subrs )\d+( array)$/) { + next if (/\/UniqueID .*$/); + s /(\/BlueValues \[.*)(\] def)$/$1 $accheight $accheight$2/; + if (/(\/Subrs )\d+( array)$/) { print OUTDIS "$1$subrsnum$2\n"; last; } @@ -596,6 +614,7 @@ sub supacc { ($old = $metrics_enc[$num]) =~ s/^C $num/C -1/; $metrics_unenc .= $old unless $metrics_unenc =~ /$old/m; if ($char eq "i") { $char = "dotlessi" } + if ($char eq "j") { $char = "dotlessj" } if ($acc eq "overdot") { $acc = "dotaccent" } if ($acc eq "candrabindu") { $acc = "breve"; @@ -784,7 +803,7 @@ sub digraph { $astr .= (max($chht{$char}, $chht{$acc})) . " ;\n"; $metrics_enc[$num] = $astr; unless (defined $hend{$char}) { findend($char, $chstrings{$char}) } - $H = $chwd{$char} + $chls{$acc} + $kern - $hend{$char} - $chls{$char}; + $H = $chwd{$char} + $chls{$acc} + $kern - $hend{$char}; $V = -$vend{$char}; $chstrings{$char} =~ /^\/$char {\n(\t.+?hsbw\n(.|\n)*?)\tendchar\n\t} $rend\n/m; ($chdef = $1) =~ s/-?\d+( hsbw\n)/$w$1/m; @@ -897,12 +916,16 @@ sub fixshrink { sub fixhints { # - # Collect the hints from the accent definition, remove them, adjust - # for horizontal and vertical offset, and place them in a numbered - # subroutine. Have the definition call the subroutine. + # First adjust any Flex "0 callsubr" lines for horizontal and + # vertical offset. Then collect the hints from the accent definition, + # remove them, adjust for horizontal and vertical offset, and + # place them in a numbered subroutine. Have the definition call + # the subroutine. # my ($nchar, $acc, $acdef, $h, $v) = @_; my $subrdef; + $acdef =~ s[^(\t-?\d+ )(-?\d+) (-?\d+)( 0 callsubr)$] + [$1 . ($2 + $h) . " " . ($3 + $v) . $4]gme; if ($subrdef = join("\n", grep /^\t.*[hv]stem$/, split(/\n/, $acdef))) { $acdef = join("\n", grep !/^\t.*[hv]stem$/, split(/\n/, $acdef)) . "\n"; } @@ -970,9 +993,10 @@ sub findend { findend($char, $subrs[$1]); last SWITCH; }; - $line =~ /1 callothersubr$/ + $line =~ /^\t-?\d+ (-?\d+) (-?\d+) 0 callsubr$/ # Flex && do { - print STDERR "Warning: definition of character $char uses Flex\n"; + $hend{$char} = $1; + $vend{$char} = $2; last SWITCH; }; } |