source: trunk/filemanager/tp/dompdf/lib/ttf2ufm/ttf2ufm-src/other/cntstems.pl @ 2000

Revision 2000, 1002 bytes checked in by amuller, 14 years ago (diff)

Ticket #597 - Implementação do módulo gerenciador de arquivos

Line 
1#!/usr/bin/perl
2#
3# Copyright (c) 2000 by Sergey Babkin
4# (see COPYRIGHT for full copyright notice)
5#
6# script to calculate the total number of stems used by the
7# glyphs in case if stems are always pushed to the stack and
8# never popped (as X11 does)
9
10$insubrs = 0;
11$inchars = 0;
12
13while(<>)
14{
15        if(/\/Subrs/) {
16                $insubrs = 1;
17        } elsif(/\/CharStrings/) {
18                $insubrs = 0;
19                $inchars = 1;
20        }
21        if($insubrs && /^dup (\d+)/) {
22                $cursubr = $1;
23                $substems[$cursubr] = 0;
24        } elsif (/^dup (\d+) \/(\S+) put/) {
25                $codeof{$2} = $1;
26        }
27        if($inchars) {
28                if(/^\/(\S+)\s+\{/) {
29                        $curchar = $1;
30                        $charstems = 0;
31                } elsif( /endchar/ ) {
32                        printf("%d:%s\t%d\n", $codeof{$curchar}, $curchar, $charstems);
33                } elsif( /(\d+)\s+4\s+callsubr/) {
34                        $charstems += $substems[$1+0];
35                }
36        }
37        if(/[hv]stem3/) {
38                if($insubrs) {
39                        $substems[$cursubr] += 3;
40                } elsif($inchars) {
41                        $charstems += 3;
42                }
43        } elsif( /[hv]stem/ ) {
44                if($insubrs) {
45                        $substems[$cursubr]++;
46                } elsif($inchars) {
47                        $charstems++;
48                }
49        }
50}
Note: See TracBrowser for help on using the repository browser.