diff options
Diffstat (limited to 'Master/texmf-dist/doc/fonts/accfonts/mkt1font')
-rwxr-xr-x | Master/texmf-dist/doc/fonts/accfonts/mkt1font | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/Master/texmf-dist/doc/fonts/accfonts/mkt1font b/Master/texmf-dist/doc/fonts/accfonts/mkt1font index a82e9181437..966ba5932d9 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.24; +$version = 0.25; #-----------------------------------------------------------------------------# $description = "Syntax: mkt1font -n fontname -d definition-file -a afm-file -f font-file @@ -326,30 +326,28 @@ $v2 = $capheight - $xheight; # vertical offset for accented caps etc # $itadj = sin($italangle * 3.14159 / 180) / cos($italangle * 3.14159 / 180); -################# -# Create dotlessj -################# +########################### +# Create uni0237 (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 } +$chstrings{uni0237} = $chstrings{j} . "\n"; +$chstrings{uni0237} =~ /\A(.*?)(\t[-0-9 ]+?[rvh]moveto)(\n.+)(\n\t.*?(-?\d+) [rv]moveto)(.*?)(\n\tendchar.*?)\Z/ms; +($one, $two, $three, $four, $five, $six, $seven) = ($1, $2, $3, $4, $5, $6, $7); +if ($five > 0) { $chstrings{uni0237} = $one . $two . $three . $seven } else { findend("j1", ($two . $three)); $j1end = "\t$hend{j1} $vend{j1} rmoveto"; - $chstrings{dotlessj} = $one . $j1end . $four . $six + $chstrings{uni0237} = $one . $j1end . $four . $six . $seven } -$chstrings{dotlessj} =~s/\A\/j /\/dotlessj /m; -$chdefsnum += 1; +$chstrings{uni0237} =~s/\A\/j /\/uni0237 /m; getcharinfo("j"); getcharinfo("dotlessi"); -$metrics_unenc .= "C -1 ; WX $chwd{j} ; N dotlessj ; B $chls{j} $chdp{j} $chrs{j} $chht{dotlessi} ;\n"; - +$metrics_unenc .= "C -1 ; WX $chwd{j} ; N uni0237 ; B $chls{j} $chdp{j} $chrs{j} $chht{dotlessi} ;\n"; +# ###################### # Build the characters ###################### # -# # First build a list of definitions supplied by user # for (@deflines) { @@ -567,8 +565,9 @@ while (<DIS>) { # get header close DIS; unlink $disfile1; foreach $subrdef (@subrs) { print OUTDIS $subrdef } +$chdefsnum = scalar(keys(%chstrings)); print OUTDIS "$nd\n2 index /CharStrings $chdefsnum dict dup begin\n"; -foreach $chdef (sort values %chstrings) { print OUTDIS $chdef } +foreach (sort values %chstrings) { print OUTDIS } print OUTDIS $distail; close OUTDIS; system "t1asm -b $disfile2 >$opt_n.pfb 2>/dev/null"; @@ -590,7 +589,7 @@ sub subacc { $astr = "C $num ; WX $chwd{$char} ; N $nchar ; B $chls{$char} "; $astr .= "$chdp{$acc} $chrs{$char} $chht{$char} ;\n"; $metrics_enc[$num] = $astr; - $h = int(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc}); + $h = round(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc}); unless (defined $hend{$char}) { findend($char, $chstrings{$char}) } $H = $h - $hend{$char} - $chls{$char}; $V = -$vend{$char}; @@ -602,7 +601,6 @@ sub subacc { $pstr = "/$nchar {\n$chdef % $nchar: start of $acc\n"; $pstr .= "\t$H $V rmoveto\n$acdef"; $chstrings{$nchar} = $pstr; - $chdefsnum += 1; } sub supacc { @@ -614,7 +612,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 ($char eq "j") { $char = "uni0237" } if ($acc eq "overdot") { $acc = "dotaccent" } if ($acc eq "candrabindu") { $acc = "breve"; @@ -645,7 +643,7 @@ sub supacc { $astr .= "$v ;\n"; $metrics_enc[$num] = $astr; $v -= $chht{$acc}; - $h = int(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc} - $it); + $h = round(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc} - $it); unless (defined $hend{$char}) { findend($char, $chstrings{$char}) } $H = $h - $hend{$char} - $chls{$char}; $V = $v - $vend{$char}; @@ -658,7 +656,7 @@ sub supacc { $pstr .= "\t$H $V rmoveto\n$acdef"; if ($cb) { # candrabindu getcharinfo("dotaccent") unless defined $chwd{dotaccent}; - $h = int(($chwd{$char} - $chwd{dotaccent}) / 2 + $chls{dotaccent} - $it); + $h = round(($chwd{$char} - $chwd{dotaccent}) / 2 + $chls{dotaccent} - $it); $h += $cbx; $v += $cby; $cb = fixhints($nchar, "dotaccent", $cb, $h, $v); @@ -669,8 +667,7 @@ sub supacc { $pstr =~ s/\tendchar\n\t} $rend\n\Z//m; $pstr .= " % $nchar: start of dotaccent\n\t$H $V rmoveto\n$cb"; } - $chstrings{$nchar} = $pstr; - $chdefsnum += 1; +$chstrings{$nchar} = $pstr; } sub underacc { @@ -696,7 +693,7 @@ sub underacc { getcharinfo($char) unless defined $chwd{$char}; getcharinfo($acc) unless defined $chwd{$acc}; if ($acc =~ /^$supacc$/) { - $v = int($underadp + ($chdp{$acc} - $accdepth) * $shrink); + $v = round($underadp + ($chdp{$acc} - $accdepth) * $shrink); } else { $v = $underddp + $chdp{$acc} } if ($v < $maxdp) { $maxdp = $v } @@ -704,21 +701,21 @@ sub underacc { $astr .= "$v $chrs{$char} $chht{$char} ;\n"; $metrics_enc[$num] = $astr; if ($acc =~ /^$supacc$/) { - $h = int(($chwd{$char} - ($chwd{$acc} * $shrink)) / 2 + $h = round(($chwd{$char} - ($chwd{$acc} * $shrink)) / 2 + $chls{$acc} * $shrink - ($v - $accdepth * $shrink) * $itadj); } else { - $h = int(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc} - $v * $itadj); + $h = round(($chwd{$char} - $chwd{$acc}) / 2 + $chls{$acc} - $v * $itadj); } unless (defined $hend{$char}) { findend($char, $chstrings{$char}) } $H = $h - $hend{$char} - $chls{$char}; if ($acc =~ /^$supacc$/) { $V = $underadp - $vend{$char} } - else { $V = $underddp - $vend{$char} } + else { $V = $v - $chdp{$acc} - $vend{$char} } # # Adjustment for smaller, therefore lower, shrunken accent defs # if ($acc =~ /^$supacc$/) { - $V += int($chdp{$acc} * (1 - $shrink) / $shrink); + $V += round($chdp{$acc} * (1 - $shrink) / $shrink); } $chstrings{$char} =~ /^\/$char {\n(\t.+?hsbw\n(.|\n)*?)\tendchar\n\t} $rend\n/m; $chdef = $1; @@ -752,7 +749,6 @@ sub underacc { $pstr = "/$nchar {\n$chdef % $nchar: start of $acname\n"; $pstr .= "\t$H $V rmoveto\n$acdef"; $chstrings{$nchar} = $pstr; - $chdefsnum += 1; } sub underb { @@ -765,8 +761,8 @@ sub underb { $metrics_unenc .= $old unless $metrics_unenc =~ /$old/m; $v = $underbdp + $thk; getcharinfo($char) unless defined $chwd{$char}; - $h = int(0.1 * $chwd{$char} - $underbdp * $itadj); - $l = int(0.8 * $chwd{$char}); + $h = round(0.1 * $chwd{$char} - $underbdp * $itadj); + $l = round(0.8 * $chwd{$char}); $astr = "C $num ; WX $chwd{$char} ; N $nchar ; B $chls{$char} "; $astr .= "$underbdp $chrs{$char} $chht{$char} ;\n"; $metrics_enc[$num] = $astr; @@ -781,7 +777,6 @@ sub underb { $pstr = "/$nchar {\n$chdef % $nchar: start of $acc\n"; $pstr .= "\t$H $V rmoveto\n$acdef\tendchar\n\t} $nd\n"; $chstrings{$nchar} = $pstr; - $chdefsnum += 1; } sub digraph { @@ -813,7 +808,6 @@ sub digraph { $pstr = "/$nchar {\n$chdef % $nchar: start of $acc\n"; $pstr .= "\t$H $V rmoveto\n$acdef"; $chstrings{$nchar} = $pstr; - $chdefsnum += 1; } sub max { @@ -832,6 +826,20 @@ sub min { return $a > $b ? $b : $a; } +sub round { + # + # Return nearest integer value + # + my ($num) = shift; + my $n1, $n2; + if ($num < 0) { $n1 = (0 - $num) } + else { $n1 = $num } + $n2 = int($n1); + if (($n1 - $n2) >= 0.5) { $n2++ } + if ($num < 0) { return (0 - $n2) } + else { return $n2 } +} + sub getcharinfo { # # Store character metric information @@ -995,8 +1003,8 @@ sub findend { }; $line =~ /^\t-?\d+ (-?\d+) (-?\d+) 0 callsubr$/ # Flex && do { - $hend{$char} = $1; - $vend{$char} = $2; + $hend{$char} = $1; + $vend{$char} = $2; last SWITCH; }; } |