File: ftname

package info (click to toggle)
perlftlib 1.2-16
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 180 kB
  • ctags: 185
  • sloc: perl: 1,941; makefile: 104
file content (59 lines) | stat: -rwxr-xr-x 1,674 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /usr/bin/perl

use Jcode;

if ($#ARGV != 0) {
    print STDERR "usage: $0 <font path>\n";
    exit 1;
}

$fontFile = $ARGV[0];

push(@INC, "./blib/arch");
push(@INC, "./blib/lib");
eval("use FreeType");

FreeType::TT_Init_FreeType($engine);
FreeType::TT_Open_Face($engine, $fontFile, $face);
FreeType::TT_Get_Face_Properties($face, $properties);
$numFace = $properties->{num_Faces};
if (0 == $numFace) {
    print "num face : not correction\n";
    $numFace = 1;
} else {
    print "num face : ", $numFace, "\n";
}
FreeType::TT_Close_Face($face);

for ($j=0; $j<$numFace; $j++) {
    FreeType::TT_Open_Collection($engine, $fontFile, $j, $face);
    $count=FreeType::TT_Get_Name_Count($face);
    print "face number : $j\n";
    print "  count : $count\n";
    for ($i=0; $i<$count; $i++) {
        FreeType::TT_Get_Name_ID($face, $i, $platformID,
                                 $encodingID, $languageID, $nameID);
        FreeType::TT_Get_Name_String($face, $i, $string);
        if (3 == $platformID && 1 == $encodingID) {
            $tmp = $string;
            undef $string;
            foreach ($tmp =~ m,..,g) {
                ($b1, $b2) = m,.,g;
                if (ord($b1) == 0) {
                    $b1 = '';
                } else {
                    $b1 = $b2 = '.';
                }
                $string .= $b1.$b2;
            }
        }
        Jcode::convert(*string, 'euc', 'sjis');
        printf
            "    %03d : platformID=%d encoding=%d, languageID=%d, " .
            "nameID=%d, name=\"%s\"\n",
              $i, $platformID, $encodingID, $languageID, $nameID, $string;
    }
}
FreeType::TT_Done_FreeType($engine);

# end of file