Subject: | GDEF LIG writing does not work at all |
Date: | Sat, 24 Jan 2009 02:22:07 +0000 |
To: | bug-Font-TTF [...] rt.cpan.org |
From: | Philip Taylor <pjt47 [...] cam.ac.uk> |
There are two bugs that break GDEF::out's handling of LIG:
It uses Font::TTF::Ttopen->ref_cache, when it should instead be
Font::TTF::Ttopen::ref_cache (note "->" vs "::").
It outputs LigCaretList as the coverage table offset, then a zero which
shouldn't be there, then the lig-glyph count, then the lig-glyph array.
It breaks because of the zero which shouldn't be there.
The attached patch appears to work in my (fairly minimal) testing of
some format 1 LIGs (in particular I haven't tested format 3).
--
Philip Taylor
pjt47@cam.ac.uk
--- orig_GDEF.pm 2009-01-24 02:16:39.000000000 +0000
+++ patch_GDEF.pm 2009-01-24 02:16:41.000000000 +0000
@@ -47,8 +47,8 @@ sub out
$ltables = {};
$loff = $fh->tell() - $loc;
$out = pack('n*',
- Font::TTF::Ttopen->ref_cache($self->{'LIG'}{'COVERAGE'}, $ltables, 0),
- 0, $#{$self->{'LIG'}{'LIGS'}} + 1,
+ Font::TTF::Ttopen::ref_cache($self->{'LIG'}{'COVERAGE'}, $ltables, 0),
+ $#{$self->{'LIG'}{'LIGS'}} + 1,
(0) x ($#{$self->{'LIG'}{'LIGS'}} + 1));
push (@reftables, [$ltables, 0]);
$i = 0;
@@ -64,7 +64,7 @@ sub out
substr($out, ($j << 1) + 2 + $loc1, 2) =
TTF_Pack('S', length($out) - $loc1);
$out .= TTF_Pack('SS', $s->{'FMT'}, $s->{'VAL'});
- $out .= pack('n', Font::TTF::Ttopen->ref_cache($s->{'DEVICE'},
+ $out .= pack('n', Font::TTF::Ttopen::ref_cache($s->{'DEVICE'},
$ltables, length($out))) if ($s->{'FMT'} == 3);
$j++;
}