/usr/share/perl5/Font/TTF/Gloc.pm is in libfont-ttf-perl 1.06-1.
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 | package Font::TTF::Gloc;
=head1 NAME
Font::TTF::Gloc - Offsets into Glat table for the start of the attributes for each glyph
=head1 DESCRIPTION
The Gloc table is a bit like the Loca table only for Graphite glyph attributes. The table
has the following elements:
=over 4
=item Version
Table format version
=item numAttrib
Maximum number of attributes associated with a glyph.
=item locations
An array of offsets into the Glat table for the start of each glyph
=item names
If defined, an array of name table name ids indexed by attribute number.
=cut
use Font::TTF::Table;
use Font::TTF::Utils;
use strict;
use vars qw(@ISA);
@ISA = qw(Font::TTF::Table);
sub read
{
my ($self) = @_;
$self->SUPER::read or return $self;
my ($fh) = $self->{' INFILE'};
my ($numGlyphs);
my ($dat, $flags);
$fh->read($dat, 4);
($self->{'Version'}) = TTF_Unpack("v", $dat);
$fh->read($dat, 4);
($flags, $self->{'numAttrib'}) = TTF_Unpack("SS", $dat);
$numGlyphs = ($self->{' LENGTH'} - 8 - ($flags & 2 ? $self->{'numAttrib'} * 2 : 0)) / (($flags & 1) ? 4 : 2) - 1;
$self->{'numGlyphs'} = $numGlyphs;
if ($flags & 1)
{
$fh->read($dat, 4 * ($numGlyphs + 1));
$self->{'locations'} = [unpack("N*", $dat)];
}
else
{
$fh->read($dat, 2 * ($numGlyphs + 1));
$self->{'locations'} = [unpack("n*", $dat)];
}
if ($flags & 2)
{
$fh->read($dat, 2 * $self->{'numAttrib'});
$self->{'names'} = [unpack("n*", $dat)];
}
return $self;
}
sub out
{
my ($self, $fh) = @_;
my ($numGlyphs) = 0;
my ($flags, $num);
return $self->SUPER::out($fh) unless ($self->{' read'});
$numGlyphs = scalar @{$self->{' PARENT'}{'Glat'}{'attribs'}};
$num = $self->{'numAttrib'};
$flags = 1 if ($self->{'locations'}[-1] > 0xFFFF);
$flags |= 2 if ($self->{'names'});
$fh->print(TTF_Pack("vSS", $self->{'Version'}, $flags, $num));
$fh->write(pack(($flags & 1 ? "N" : "n") . ($numGlyphs + 1), @{$self->{'locations'}}));
if ($flags & 2)
{ $fh->write(pack("n$num", @{$self->{'names'}})); }
}
=back
=head2 $t->minsize()
Returns the minimum size this table can be. If it is smaller than this, then the table
must be bad and should be deleted or whatever.
=cut
sub minsize
{
return 8;
}
1;
=head1 AUTHOR
Martin Hosken L<http://scripts.sil.org/FontUtils>.
=head1 LICENSING
Copyright (c) 1998-2016, SIL International (http://www.sil.org)
This module is released under the terms of the Artistic License 2.0.
For details, see the full text of the license in the file LICENSE.
=cut
|