This file is indexed.

/usr/share/perl5/Font/TTF/EBLC.pm is in libfont-ttf-perl 1.04-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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
package Font::TTF::EBLC;

=head1 NAME

Font::TTF::EBLC - Embeeded Bitmap Location Table

=head1 DESCRIPTION

Contains the sizes and glyph ranges of bitmaps, and the offsets to
glyph bitmap data in indexSubTables for EBDT.

Possibly contains glyph metrics information.

=head1 INSTANCE VARIABLES

The information specified 'B<(R)>ead only' is read only, those
are calculated from EBDT, when it is 'update'-ed.

=over 4

=item bitmapSizeTable

An array of tables of following information

=over 8

=item indexSubTableArrayOffset (R)

=item indexTablesSize (R)

=item numberOfIndexSubTables (R)

=item colorRef

=item hori

=item vert

=item startGlyphIndex (R)

=item endGlyphIndex (R)

=item ppemX

=item ppemY

=item bitDepth

=item flags

=back

=item indexSubTableArray (R)

An array which contains range information.

=item indexSubTable (R)

An array which contains offsets of EBDT table.

=back

=head1 METHODS

=cut

use strict;
use vars qw(@ISA);
require Font::TTF::Table;

@ISA = qw(Font::TTF::Table);


=head2 $t->read

Reads the location information of embedded bitmap from the TTF file into memory

=cut

sub read
{
    my ($self) = @_;

    $self->SUPER::read or return $self;

    my ($fh) = $self->{' INFILE'};
    my ($i, $dat);
    my ($indexSubTableArrayOffset,
        $indexTablesSize,
        $numberOfIndexSubTables,
        $colorRef);
    my ($startGlyphIndex,
        $endGlyphIndex,
        $ppemX, $ppemY,
        $bitDepth, $flags);
    my (@hori, @vert);
    my ($bst, $ista, $ist);
    my ($j);


    # eblcHeader
    $fh->read($dat, 4);
    $self->{'version'} = unpack("N",$dat);

    $fh->read($dat, 4);
    $self->{'Num'} = unpack("N",$dat);

    # bitmapSizeTable
    for ($i = 0; $i < $self->{'Num'}; $i++) {
        $fh->read($dat, 16);
        ($indexSubTableArrayOffset, $indexTablesSize,
         $numberOfIndexSubTables, $colorRef) = unpack("NNNN", $dat);
        $fh->read($dat, 12); @hori = unpack("cccccccccccc", $dat);
        $fh->read($dat, 12); @vert = unpack("cccccccccccc", $dat);

        $fh->read($dat, 8);
        ($startGlyphIndex, $endGlyphIndex,
         $ppemX, $ppemY, $bitDepth, $flags) = unpack("nnCCCC", $dat);

        $self->{'bitmapSizeTable'}[$i] = {
            'indexSubTableArrayOffset' => $indexSubTableArrayOffset,
            'indexTablesSize' => $indexTablesSize,
            'numberOfIndexSubTables' => $numberOfIndexSubTables,
            'colorRef' => $colorRef,
            'hori' => [@hori],
            'vert' => [@vert],
            'startGlyphIndex' => $startGlyphIndex,
            'endGlyphIndex' => $endGlyphIndex,
            'ppemX' => $ppemX,
            'ppemY' => $ppemY,
            'bitDepth' => $bitDepth,
            'flags' => $flags
            };
    }

    for ($i = 0; $i < $self->{'Num'}; $i++) {
        my ($count, $x);

        $bst = $self->{'bitmapSizeTable'}[$i];

        for ($j = 0; $j < $bst->{'numberOfIndexSubTables'}; $j++) {
            $ista = {};

            # indexSubTableArray
            $self->{'indexSubTableArray'}[$i][$j] = $ista;
            $fh->read($dat, 8);
            ($ista->{'firstGlyphIndex'},
             $ista->{'lastGlyphIndex'},
             $ista->{'additionalOffsetToIndexSubtable'})
                = unpack("nnN", $dat);
        }

        # indexSubTable
        # indexSubHeader
        $fh->read($dat, 8);
        ($bst->{'indexFormat'}, 
         $bst->{'imageFormat'}, 
         $bst->{'imageDataOffset'}) = unpack("nnN", $dat);

        die "Only indexFormat == 1 is supported" unless ($bst->{'indexFormat'} == 1);

        for ($j = 0; $j < $bst->{'numberOfIndexSubTables'}; $j++) {
            $ista = $self->{'indexSubTableArray'}[$i][$j];
            $count = $ista->{'lastGlyphIndex'} - $ista->{'firstGlyphIndex'} + 1 + 1;
            $fh->seek($self->{' OFFSET'} + $bst->{'indexSubTableArrayOffset'}
                      + $ista->{'additionalOffsetToIndexSubtable'} + 8, 0);

#           $count += 2 if $j < $bst->{'numberOfIndexSubTables'} - 1;

            $fh->read($dat, 4*$count);

            $self->{'indexSubTable'}[$i][$j] = [unpack("N*", $dat)];
        }
    }

    $self;
}

=head2 $t->out($fh)

Outputs the location information of embedded bitmap for this font.

=cut

sub out
{
    my ($self, $fh) = @_;
    my ($i);

    return $self->SUPER::out($fh) unless $self->{' read'};

    my ($bst_array) = $self->{'bitmapSizeTable'};

    $fh->print(pack("N", 0x00020000));
    $fh->print(pack("N", $self->{'Num'}));

    for ($i = 0; $i < $self->{'Num'}; $i++) {
        my ($bst) = $bst_array->[$i];

        $fh->print(pack("NNNN", 
                        $bst->{'indexSubTableArrayOffset'},
                        $bst->{'indexTablesSize'},
                        $bst->{'numberOfIndexSubTables'},
                        $bst->{'colorRef'}));
        $fh->print(pack("cccccccccccc", @{$bst->{'hori'}}));
        $fh->print(pack("cccccccccccc", @{$bst->{'vert'}}));
        $fh->print(pack("nnCCCC", $bst->{'startGlyphIndex'}, 
                        $bst->{'endGlyphIndex'}, $bst->{'ppemX'},
                        $bst->{'ppemY'}, $bst->{'bitDepth'}, $bst->{'flags'}));
    }

    for ($i = 0; $i < $self->{'Num'}; $i++) {
        my ($bst) = $bst_array->[$i];
        my ($j);

        for ($j = 0; $j < $bst->{'numberOfIndexSubTables'}; $j++) {
            my ($ista) = $self->{'indexSubTableArray'}[$i][$j];

            $fh->print("nnN",
                       $ista->{'firstGlyphIndex'},
                       $ista->{'lastGlyphIndex'},
                       $ista->{'additionalOffsetToIndexSubtable'});
        }

        $fh->print(pack("nnN", $bst->{'indexFormat'}, $bst->{'imageFormat'}, 
                        $bst->{'imageDataOffset'}));

        die "Only indexFormat == 1 is supported" unless ($bst->{'indexFormat'} == 1);

        for ($j = 0; $j < $bst->{'numberOfIndexSubTables'}; $j++) {
            $fh->print(pack("N*", $self->{'indexSubTable'}[$i][$j]));
        }
    }
}

1;

=head1 BUGS

Only indexFormat ==1 is implemented.  XML output is not supported (yet).

=head1 AUTHOR

NIIBE Yutaka L<gniibe@fsij.org>.  
This was written at the CodeFest Akihabara 2006 hosted by FSIJ.

Patch sent with licensing requirements??

=head1 LICENSING

Copyright (c) 1998-2013, 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