r3366 - in /packages/libfont-ttf-perl/branches/upstream/current: COPYING MANIFEST MANIFEST.SKIP META.yml Makefile Makefile.PL lib/Font/TTF.pm lib/Font/TTF/EBDT.pm lib/Font/TTF/EBLC.pm lib/Font/TTF/Font.pm lib/Font/TTF/Hmtx.pm lib/Font/TTF/Ttopen.pm

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Wed Aug 2 10:30:54 UTC 2006


Author: eloy
Date: Wed Aug  2 10:30:52 2006
New Revision: 3366

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3366
Log:
Load /tmp/tmp.rkJYg11474/libfont-ttf-perl-0.40 into
packages/libfont-ttf-perl/branches/upstream/current.

Added:
    packages/libfont-ttf-perl/branches/upstream/current/COPYING
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF.pm
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBDT.pm
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBLC.pm
Removed:
    packages/libfont-ttf-perl/branches/upstream/current/Makefile
Modified:
    packages/libfont-ttf-perl/branches/upstream/current/MANIFEST
    packages/libfont-ttf-perl/branches/upstream/current/MANIFEST.SKIP
    packages/libfont-ttf-perl/branches/upstream/current/META.yml
    packages/libfont-ttf-perl/branches/upstream/current/Makefile.PL
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Font.pm
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Hmtx.pm
    packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Ttopen.pm

Added: packages/libfont-ttf-perl/branches/upstream/current/COPYING
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/COPYING?rev=3366&op=file
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/COPYING (added)
+++ packages/libfont-ttf-perl/branches/upstream/current/COPYING Wed Aug  2 10:30:52 2006
@@ -1,0 +1,50 @@
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+    * "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification.
+    * "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder.
+    * "Copyright Holder" is whoever is named in the copyright or copyrights for the package.
+    * "You" is you, if you're thinking about copying or distributing this Package.
+    * "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.)
+    * "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:
+
+    a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package.
+
+    b) use the modified Package only within your corporation or organization.
+
+    c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following:
+
+    a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version.
+
+    b) accompany the distribution with the machine-readable source of the Package with your modifications.
+
+    c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End

Modified: packages/libfont-ttf-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/MANIFEST?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/MANIFEST Wed Aug  2 10:30:52 2006
@@ -1,3 +1,5 @@
+COPYING
+lib/Font/TTF.pm
 lib/Font/TTF/AATKern.pm
 lib/Font/TTF/AATutils.pm
 lib/Font/TTF/Anchor.pm
@@ -7,6 +9,8 @@
 lib/Font/TTF/Coverage.pm
 lib/Font/TTF/Cvt_.pm
 lib/Font/TTF/Delta.pm
+lib/Font/TTF/EBDT.pm
+lib/Font/TTF/EBLC.pm
 lib/Font/TTF/Fdsc.pm
 lib/Font/TTF/Feat.pm
 lib/Font/TTF/Fmtx.pm
@@ -59,9 +63,8 @@
 lib/Font/TTF/Win32.pm
 lib/Font/TTF/XMLparse.pm
 lib/ttfmod.pl
-Makefile
 Makefile.PL
 MANIFEST			This list of files
 MANIFEST.SKIP
+META.yml
 README.TXT
-META.yml                                 Module meta-data (added by MakeMaker)

Modified: packages/libfont-ttf-perl/branches/upstream/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/MANIFEST.SKIP?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/MANIFEST.SKIP (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/MANIFEST.SKIP Wed Aug  2 10:30:52 2006
@@ -10,8 +10,10 @@
 \.cvsignore
 ^#
 \.svn/
-Makefile
+Makefile$
 \.par$
 -stamp$
 debian/
 pm_to_blib
+\~$
+dev/

Modified: packages/libfont-ttf-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/META.yml?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/META.yml (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/META.yml Wed Aug  2 10:30:52 2006
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Font-TTF
-version:      0.39
+version:      0.40
 version_from: lib/Font/TTF.pm
 installdirs:  site
 requires:

Modified: packages/libfont-ttf-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/Makefile.PL?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/Makefile.PL Wed Aug  2 10:30:52 2006
@@ -1,44 +1,44 @@
-use ExtUtils::MakeMaker;
-
- at theselibs = grep {-f } glob("lib/Font/TTF/*");
-
+use ExtUtils::MakeMaker;
+
+ at theselibs = (grep {-f } glob("lib/Font/TTF/*"), "lib/Font/TTF.pm");
+
 # incantation to enable MY::pm_to_blib later on
 if ($^O eq 'MSWin32')
-{
+{
     push(@ExtUtils::MakeMaker::Overridable, qw(pm_to_blib));
-    @extras = ('dist' => { 'TO_UNIX' => 'perl -Mtounix -e "tounix(\"$(DISTVNAME)\")"' });
+    @extras = ('dist' => { 'TO_UNIX' => 'perl -Mtounix -e "tounix(\"$(DISTVNAME)\")"' });
 }
-
-WriteMakefile (
+
+WriteMakefile (
         NAME => "Font::TTF",
-        VERSION_FROM => 'lib/Font/TTF.pm',
-#        VERSION => "0.38",
-#        HTMLLIBPODS => {map {my $t = $_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @theselibs},
-#        HTMLSCRIPTPODS => {map {my $t=$_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @scripts},
-        AUTHOR => "martin_hosken\@sil.org",
-        ABSTRACT => "TTF font support for Perl",
-        @extras
-    );
-
-if ($^O eq 'MSWin32') {
-# incantation to solve the problem of everyone's $Config{make} being 'nmake'
-# when we want 'pmake'. And $Config{} is read only.
-# actually, this is just a copy of the code from ExtUtiles::MM_Win32 tidied
-# up (to expose tabs) and the dependency on Config removed
-sub MY::pm_to_blib
-{
-    my $self = shift;
-    my($autodir) = $self->catdir('$(INST_LIB)','auto');
-    return <<"EOT";
-
-pm_to_blib: \$(TO_INST_PM)
-\t$self->{NOECHO}\$(PERL) \"-I\$(INST_ARCHLINE)\" \"-I\$(INST_LIB)\" \\
-\t\"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" -MExtUtils::Install \\
-\t-e \"pm_to_blib({ qw[\$(PM_TO_BLIB)] }, '$autodir')
-\t$self->{NOECHO}\$(TOUCH) \$@
-
-EOT
-}
-
-}
-
+        VERSION_FROM => 'lib/Font/TTF.pm',
+#        VERSION => "0.38",
+#        HTMLLIBPODS => {map {my $t = $_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @theselibs},
+#        HTMLSCRIPTPODS => {map {my $t=$_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @scripts},
+        AUTHOR => "martin_hosken\@sil.org",
+        ABSTRACT => "TTF font support for Perl",
+        @extras
+    );
+
+if ($^O eq 'MSWin32') {
+# incantation to solve the problem of everyone's $Config{make} being 'nmake'
+# when we want 'pmake'. And $Config{} is read only.
+# actually, this is just a copy of the code from ExtUtiles::MM_Win32 tidied
+# up (to expose tabs) and the dependency on Config removed
+sub MY::pm_to_blib
+{
+    my $self = shift;
+    my($autodir) = $self->catdir('$(INST_LIB)','auto');
+    return <<"EOT";
+
+pm_to_blib: \$(TO_INST_PM)
+\t$self->{NOECHO}\$(PERL) \"-I\$(INST_ARCHLINE)\" \"-I\$(INST_LIB)\" \\
+\t\"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" -MExtUtils::Install \\
+\t-e \"pm_to_blib({ qw[\$(PM_TO_BLIB)] }, '$autodir')
+\t$self->{NOECHO}\$(TOUCH) \$@
+
+EOT
+}
+
+}
+

Added: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF.pm?rev=3366&op=file
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF.pm (added)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF.pm Wed Aug  2 10:30:52 2006
@@ -1,0 +1,16 @@
+package Font::TTF;
+
+$VERSION = '0.40';    # MJPH    31-JUL-2006      Add EBDT, EBLC tables
+# $VERSION = 0.39;
+
+1;
+
+=head1 NAME
+
+Font::TTF - Perl module for TrueType Font hacking
+
+=head1 DESCRIPTION
+
+This module allows you to do almost anything to a TrueType/OpenType Font
+including modify and inspect nearly all tables.
+

Added: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBDT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBDT.pm?rev=3366&op=file
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBDT.pm (added)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBDT.pm Wed Aug  2 10:30:52 2006
@@ -1,0 +1,285 @@
+package Font::TTF::EBDT;
+
+=head1 NAME
+
+Font::TTF::EBDT - Embeeded Bitmap Data Table
+
+=head1 DESCRIPTION
+
+Contains the metrics and bitmap image data.
+
+=head1 INSTANCE VARIABLES
+
+Only has 'bitmap' instance variable.  It is an array of assosiative
+array keyed by glyph-id.  The element is an object which consists
+of metric information and image data.
+
+=over 4
+
+=item bitmap object
+
+=over 8
+=item format
+Only 7 is supported.
+=item height
+=item width
+=item horiBearingX
+=item horiBearingY
+=item horiAdvance
+=item vertBearingX
+=item vertBearingY
+=item vertAdvance
+=item imageData
+
+=back
+
+=back
+
+=head1 METHODS
+
+=cut
+
+use strict;
+use vars qw(@ISA);
+require Font::TTF::Table;
+
+ at ISA = qw(Font::TTF::Table);
+
+
+=head2 $t->read
+
+Reads the embedded bitmap data from the TTF file into memory.
+This routine should be called _after_ {'EBLC'}->read.
+
+=cut
+
+sub read
+{
+    my ($self) = shift;
+    my ($fh) = $self->{' INFILE'};
+    my ($i, $dat);
+    my ($eblc) = $self->{' PARENT'}->{'EBLC'};
+    my ($bst_array);
+
+    $eblc->read;
+    $self->SUPER::read || return $self;
+
+    # ebdtHeader
+    $fh->read($dat, 4);	# version
+
+    $bst_array = $eblc->{'bitmapSizeTable'};
+
+    for ($i = 0; $i < $eblc->{'Num'}; $i++)
+    {
+        my ($bst) = $bst_array->[$i];
+        my ($format) = $bst->{'imageFormat'};
+        my ($offset) = $bst->{'imageDataOffset'};
+        my ($j);
+        my ($ist_array) = $eblc->{'indexSubTableArray'}[$i];
+        my ($bitmap) = {};
+
+        die "Only EBDT format 7 is implemented." unless  ($format == 7);
+
+        $self->{'bitmap'}[$i] = $bitmap;
+
+        for ($j = 0; $j < $bst->{'numberOfIndexSubTables'}; $j++) {
+            my ($ista) = $ist_array->[$j];
+            my ($offsetArray) = $eblc->{'indexSubTable'}[$i][$j];
+            my ($p, $o0, $c);
+
+#           if ($fh->tell != $self->{' OFFSET'} + $offset) {
+#               $fh->seek($self->{' OFFSET'} + $offset, 0);
+#           }
+
+            $p = 0;
+            $o0 = $offsetArray->[$p++];
+            for ($c = $ista->{'firstGlyphIndex'}; $c <= $ista->{'lastGlyphIndex'}; $c++)
+            {
+                my ($b) = {};
+                my ($o1) = $offsetArray->[$p++];
+                my ($len) = $o1 - $o0 - 8;
+
+#               if ($fh->tell != $self->{' OFFSET'} + $offset + $o0) {
+#                   $fh->seek($self->{' OFFSET'} + $offset + $o0, 0);
+#               }
+
+                $fh->read($dat, 8);
+                ($b->{'height'},
+                 $b->{'width'},
+                 $b->{'horiBearingX'},
+                 $b->{'horiBearingY'},
+                 $b->{'horiAdvance'},
+                 $b->{'vertBearingX'},
+                 $b->{'vertBearingY'},
+                 $b->{'vertAdvance'})
+                    = unpack("cccccccc", $dat);
+
+                $fh->read($dat, $len);
+                $b->{'imageData'} = $dat;
+                $b->{'format'} = 7; # bitmap and bigMetrics
+
+                $bitmap->{$c} = $b;
+                $o0 = $o1;
+            }
+
+            $offset += $o0;
+        }
+    }
+
+    $self;
+}
+
+
+=head2 $t->update
+
+Update EBLC information using EBDT data.
+
+=cut
+
+sub get_regions
+{
+    my (@l) = @_;
+    my (@r) = ();
+    my ($e);
+    my ($first);
+    my ($last);
+
+    $first = $l[0];
+    $last = $first - 1;
+    foreach $e (@l) {
+        if ($last + 1 != $e) {	# not contiguous
+            $r[++$#r] = [$first, $last];
+            $first = $e;
+        }
+
+        $last = $e;
+    }
+
+    $r[++$#r] = [$first, $last];
+    @r;
+}
+
+sub update
+{
+    my ($self) = @_;
+    my ($eblc) = $self->{' PARENT'}->{'EBLC'};
+    my ($bst_array) = [];
+    my ($offset) = 4;
+    my ($i);
+    my ($bitmap_array) = $self->{'bitmap'};
+    my ($istao) = 8 + 48 * $eblc->{'Num'};
+
+    $eblc->{'bitmapSizeTable'} = $bst_array;
+
+    for ($i = 0; $i < $eblc->{'Num'}; $i++) {
+        my ($bst) = {};
+        my ($ist_array) = [];
+        my ($j);
+        my ($bitmap) = $bitmap_array->[$i];
+        my (@regions) = get_regions(sort {$a <=> $b} keys (%$bitmap));
+        my ($aotis) = 8 * (1+$#regions);
+
+        $bst->{'indexFormat'} = 1;
+        $bst->{'imageFormat'} = 7;
+        $bst->{'imageDataOffset'} = $offset;
+        $bst->{'numberOfIndexSubTables'} = 1+$#regions;
+        $bst->{'indexSubTableArrayOffset'} = $istao;
+        $bst->{'colorRef'} = 0;
+
+        $bst->{'startGlyphIndex'} = $regions[0][0];
+        $bst->{'endGlyphIndex'} = $regions[-1][1];
+        $bst->{'bitDepth'} = 1;
+        $bst->{'flags'} = 1;	# Horizontal
+        $bst_array->[$i] = $bst;
+
+        $eblc->{'indexSubTableArray'}[$i] = $ist_array;
+        for ($j = 0; $j <= $#regions; $j++) {
+            my ($ista) = {};
+            my ($offsetArray) = [];
+            my ($p, $o0, $c);
+            $ist_array->[$j] = $ista;
+
+            $ista->{'firstGlyphIndex'} = $regions[$j][0];
+            $ista->{'lastGlyphIndex'} = $regions[$j][1];
+            $ista->{'additionalOffsetToIndexSubtable'} = $aotis;
+            $eblc->{'indexSubTable'}[$i][$j] = $offsetArray;
+            $p = 0;
+            $o0 = 0;
+            for ($c = $regions[$j][0]; $c <= $regions[$j][1]; $c++) {
+                my ($b) = $bitmap->{$c};
+
+                $offsetArray->[$p++] = $o0;
+                $o0 += 8 + length($b->{'imageData'});
+            }
+
+            $offsetArray->[$p++] = $o0;
+
+            $aotis += ($regions[$j][1] - $regions[$j][0] + 1 + 1)*4;
+            $offset += $o0;
+
+            # Do we need the element of 0x10007 and absolute offset here,
+            # at the end of offsetArray?
+#               if ($j + 1 <= $#regions) {
+#       	$offsetArray->[$p++] = 0x10007;
+#       	$offsetArray->[$p++] = $offset;
+#       	$aotis += 8;
+#           }
+        }
+
+        $istao += $aotis + 8;
+        $bst->{'indexTablesSize'} = $aotis + 8;
+    }
+}
+
+=head2 $t->out($fh)
+
+Outputs the bitmap data of embedded bitmap for this font.
+
+=cut
+
+sub out
+{
+    my ($self, $fh) = @_;
+    my ($eblc) = $self->{' PARENT'}->{'EBLC'};
+    my ($i);
+    my ($bitmap_array) = $self->{'bitmap'};
+
+    $fh->print(pack("N", 0x00020000));
+
+    for ($i = 0; $i < $eblc->{'Num'}; $i++) {
+        my ($j);
+        my ($bitmap) = $bitmap_array->[$i];
+        my (@regions) = get_regions(sort {$a <=> $b} keys (%$bitmap));
+
+        for ($j = 0; $j <= $#regions; $j++) {
+            my ($c);
+
+            for ($c = $regions[$j][0]; $c <= $regions[$j][1]; $c++) {
+                my ($b) = $bitmap->{$c};
+
+                $fh->print(pack("cccccccc",
+                                $b->{'height'}, $b->{'width'},
+                                $b->{'horiBearingX'}, $b->{'horiBearingY'},
+                                $b->{'horiAdvance'}, $b->{'vertBearingX'},
+                                $b->{'vertBearingY'}, $b->{'vertAdvance'}));
+                $fh->print($b->{'imageData'});
+            }
+        }
+    }
+}
+
+1;
+
+=head1 BUGS
+
+Only Format 7 is implemented.  XML output is not supported (yet).
+
+=head1 AUTHOR
+
+NIIBE Yutaka L<gniibe at fsij.org>.  See L<Font::TTF::Font> for copyright and
+licensing.
+
+This was written at the CodeFest Akihabara 2006 hosted by FSIJ.
+
+=cut
+

Added: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBLC.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBLC.pm?rev=3366&op=file
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBLC.pm (added)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/EBLC.pm Wed Aug  2 10:30:52 2006
@@ -1,0 +1,228 @@
+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;
+
+ at 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) = @_;
+    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);
+
+    $self->SUPER::read or return $self;
+
+    # 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);
+    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 at fsij.org>.  See L<Font::TTF::Font> for copyright and
+licensing.
+
+This was written at the CodeFest Akihabara 2006 hosted by FSIJ.
+
+=cut
+

Modified: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Font.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Font.pm?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Font.pm (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Font.pm Wed Aug  2 10:30:52 2006
@@ -38,6 +38,8 @@
 defaults to L<Font::TTF::Table>. The current tables which are supported are:
 
     table       Font::TTF::Table      - for unknown tables
+    EBDT        Font::TTF::EBDT
+    EBLC        Font::TTF::EBLC
     GDEF        Font::TTF::GDEF
     GPOS        Font::TTF::GPOS
     GSUB        Font::TTF::GSUB
@@ -69,7 +71,9 @@
 
 Links are:
 
-L<Font::TTF::Table> L<Font::TTF::GDEF> L<Font::TTF::GPOS> L<Font::TTF::GSUB> L<Font::TTF::LTSH>
+L<Font::TTF::Table> 
+L<Font::TTF::EBDT> L<Font::TTF::EBLC>
+L<Font::TTF::GDEF> L<Font::TTF::GPOS> L<Font::TTF::GSUB> L<Font::TTF::LTSH>
 L<Font::TTF::OS_2> L<Font::TTF::PCLT> L<Font::TTF::Bsln> L<Font::TTF::Cmap> L<Font::TTF::Cvt_>
 L<Font::TTF::Fdsc> L<Font::TTF::Feat> L<Font::TTF::Fmtx> L<Font::TTF::Fpgm> L<Font::TTF::Glyf>
 L<Font::TTF::Hdmx> L<Font::TTF::Head> L<Font::TTF::Hhea> L<Font::TTF::Hmtx> L<Font::TTF::Kern>
@@ -162,6 +166,8 @@
 
 %tables = (
         'table' => 'Font::TTF::Table',
+        'EBDT' => 'Font::TTF::EBDT',
+        'EBLC' => 'Font::TTF::EBLC',
         'GDEF' => 'Font::TTF::GDEF',
         'GPOS' => 'Font::TTF::GPOS',
         'GSUB' => 'Font::TTF::GSUB',

Modified: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Hmtx.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Hmtx.pm?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Hmtx.pm (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Hmtx.pm Wed Aug  2 10:30:52 2006
@@ -71,7 +71,7 @@
     }
     
     $i--;
-    while ($i++ < $numg)
+    while (++$i < $numg)
     {
         $fh->read($dat, 2);
         $self->{$tAdv}[$i] = $self->{$tAdv}[$numh - 1];

Modified: packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Ttopen.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Ttopen.pm?rev=3366&op=diff
==============================================================================
--- packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Ttopen.pm (original)
+++ packages/libfont-ttf-perl/branches/upstream/current/lib/Font/TTF/Ttopen.pm Wed Aug  2 10:30:52 2006
@@ -1039,6 +1039,7 @@
     } elsif ($type == 6 && $fmt == 3)
     {
         $r = $lookup->{'RULES'}[0][0];
+		no strict 'refs';	# temp fix - more code needed (probably "if" statements in the event 'PRE' or 'POST' are empty)
         $out .= pack('n2', $fmt, scalar @{$r->{'PRE'}});
         foreach $t (@{$r->{'PRE'}})
         { $out .= pack('n', Font::TTF::Ttopen::ref_cache($t, $ctables, length($out))); }




More information about the Pkg-perl-cvs-commits mailing list