Clean up elf symbol table section
[platform/upstream/nasm.git] / doc / pswidth.ph
1 #!/usr/bin/perl
2 #
3 # Get the width of a PostScript string in font units
4 # (1000 font units == the font point height) given a set of
5 # font metrics and an encoding vector.
6 #
7 sub ps_width($$$) {
8     my($str, $met, $encoding) = @_;
9     my($w) = 0;
10     my($i,$c,$p);
11
12     $l = length($str);
13     undef $p;
14     for ( $i = 0 ; $i < $l ; $i++ ) {
15         $c = substr($str,$i,1);
16         $w += $$met{widths}{$encoding->[ord($c)]};
17         # The standard PostScript "show" operator doesn't do kerning.
18         # $w += $$met{kern}{$p.$c};
19         $p = $c;
20     }
21     
22     return $w;
23 }
24
25 # OK
26 1;