/usr/share/defoma/scripts/vflib3.defoma is in vflib3 3.6.14.dfsg-1.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | #
# vflib3.defoma - defoma script for VFlib3
#
@ACCEPT_CATEGORIES = ('truetype', 'type1');
package vflib3;
use strict;
use POSIX;
use File::Basename;
use vars qw($ROOTDIR);
use Debian::Defoma::Common;
use Debian::Defoma::Font;
use Debian::Defoma::Id;
import Debian::Defoma::Font;
import Debian::Defoma::Common;
import Debian::Defoma::Id;
my $PkgDir = $ROOTDIR . '/vflib3.d';
my $VFLIBCAP = $PkgDir . '/vflibcap';
my $GENERALFAMILY = $PkgDir . '/vflibcap.general-family';
my $Id;
sub init {
unless ($Id) {
$Id = defoma_id_open_cache();
}
}
sub tt_register {
my $font = shift;
my @hints = defoma_font_get_hints('truetype', $font);
my $h = parse_hints_start('', @hints);
$h->{Priority} = 20 if !defined($h->{Priority});
defoma_id_register($Id,
type => 'real',
font => $font,
id => $h->{FontName},
priority => $h->{Priority},
hints => join(' ', @hints));
}
sub tt_unregister {
my $font = shift;
my ($name, $path, $suffix) = fileparse($font, '\..*');
defoma_id_unregister($Id, type => 'real', font => $font);
}
sub t1_register {
my $font = shift;
my @hints = defoma_font_get_hints('type1', $font);
my $h = parse_hints_start('', @hints);
$h->{Priority} = 20 if !defined($h->{Priority});
defoma_id_register($Id,
type => 'real',
font => $font,
id => $h->{FontName},
priority => $h->{Priority},
hints => join(' ', @hints));
}
sub t1_unregister {
my $font = shift;
my ($name, $path, $suffix) = fileparse($font, '\..*');
defoma_id_unregister($Id, type => 'real', font => $font);
}
sub x_main {
my $type = shift;
my $file = "$VFLIBCAP.$type";
my @list = defoma_id_grep_cache($Id, 'installed');
my (%priority, %font);
open(F, ">$file.bak") or die "$file.bak: $!";
foreach my $i (@list) {
my $font = $Id->{1}->[$i];
my @hints = defoma_id_get_hints($Id, $i);
my $h = parse_hints_start('', @hints);
$h->{Priority} = 20 if !defined($h->{Priority});
print F ";;; $h->{FontName} Macro\n";
print F "(define-macro $h->{FontName}-Macro\n";
print F " (font-class $type)\n";
print F " (character-set \"$h->{Charset}\")\n" if defined($h->{Charset});
# FIXME: ISO2022 is bad
print F " (encoding \"ISO2022 $h->{Encoding}\")\n" if defined($h->{Encoding});
print F " (font-file \"$font\")\n";
if ($type eq "truetype") {
print F " (hinting \"on\")\n";
}
print F ")\n\n";
print F ";;; $h->{FontName} Font\n";
print F "(define-macro $h->{FontName} $h->{FontName}-Macro)\n\n";
if (defined($h->{GeneralFamily})) {
$priority{$h->{GeneralFamily}} = 0 if (!$priority{$h->{GeneralFamily}});
if ($priority{$h->{GeneralFamily}} < $h->{Priority} ) {
$priority{$h->{GeneralFamily}} = $h->{Priority};
$font{$h->{GeneralFamily}} = $h->{FontName};
}
}
}
close F;
rename "$file.bak", "$file";
### Debian GeneralFamily Font ###
open(F, ">$GENERALFAMILY.bak");
print F ";; Debian GeneralFamily Font\n";
foreach (keys %font) {
print F "(define-macro debian-vfont-$_ $font{$_}-Macro)\n";
}
close F;
rename "$GENERALFAMILY.bak", "$GENERALFAMILY";
defoma_id_close_cache($Id);
system("/usr/sbin/update-vflibcap -v");
return 0;
}
sub truetype {
my $com = shift;
if ($com eq 'init') {
return init();
} elsif ($com eq 'term') {
return x_main('truetype', @_);
} elsif ($com eq 'register') {
return tt_register(@_);
} elsif ($com eq 'unregister') {
return tt_unregister(@_);
} else {
}
return 0;
}
sub type1 {
my $com = shift;
if ($com eq 'init') {
return init();
} elsif ($com eq 'term') {
return x_main('type1', @_);
} elsif ($com eq 'register') {
return t1_register(@_);
} elsif ($com eq 'unregister') {
return t1_unregister(@_);
} else {
}
return 0;
}
1;
|