- Imager::Font::BBox advance_width() method was falling back to
the wrong value when the font driver's low level function
didn't return the advance width.
+- the FT 1.x was comparing versus an uninitialized variable when
+ checking the end of string when calculating the right side bearing
+ used to adjust pos_width for glyphs that overlap the right side of the
+ advance width.
=================================================================
caching. If FT1 is faster, add caching as a TODO for FT2.
- add XS for i_tags_get_string() and test it.
- test and fix problem with fallback value for
- Imager::Font::BBox->advance_width.
+ Imager::Font::BBox->advance_width. (done)
+- i_tt_bbox_inst in font.c uses variable i without ever setting it.
- add sample CGI that handles an uploaded image (done)
- examples for fountain filter in Imager::Filters
- allow Imager::Fountain to take color descriptions (eg. blue, FF000)
static
undef_int
i_tt_bbox_inst( TT_Fonthandle *handle, int inst ,const char *txt, int len, int cords[BOUNDING_BOX_COUNT], int utf8 ) {
- int i, upm, casc, cdesc, first;
+ int upm, casc, cdesc, first;
int start = 0;
int width = 0;
descent = (gm->bbox.yMin-63) / 64;
first = 0;
}
- if (i == len-1) {
+ if (!len) { /* if at end of string */
/* the right-side bearing - in case the right-side of a
character goes past the right of the advance width,
as is common for italic fonts
$pos_width,
$global_ascent,
$descent,
- $ascent) = $font->bounding_box(string=>"Foo");
+ $ascent,
+ $advance_width) = $font->bounding_box(string=>"Foo");
$logo = $font->logo(text => "Slartibartfast Enterprises",
size => 40,
#!perl -w
use strict;
use lib 't';
-use Test::More tests => 40;
+use Test::More tests => 43;
BEGIN { use_ok(Imager => ':all') }
require "t/testtools.pl";
SKIP:
{
ok($hcfont, "loading existence test font")
- or skip("could not load test font", 11);
+ or skip("could not load test font", 14);
# list interface
my @exists = $hcfont->has_chars(string=>'!A');
print "# ** name table of the test font **\n";
Imager::i_tt_dump_names($hcfont->{id});
+
+ # the test font is known to have a shorter advance width for that char
+ my @bbox = $hcfont->bounding_box(string=>"/", size=>100);
+ is(@bbox, 7, "should be 7 entries");
+ isnt($bbox[6], $bbox[2], "different advance width from pos width");
+ print "# @bbox\n";
+ my $bbox = $hcfont->bounding_box(string=>"/", size=>100);
+ isnt($bbox->pos_width, $bbox->advance_width, "OO check");
}
undef $hcfont;
# the test font is known to have a shorter advance width for that char
my @bbox = $exfont->bounding_box(string=>"/", size=>100);
okx(@bbox == 7, "should be 7 entries");
- okx($bbox[6] != $bbox[4], "different advance width");
+ okx($bbox[6] != $bbox[2], "different advance width");
my $bbox = $exfont->bounding_box(string=>"/", size=>100);
okx($bbox->pos_width != $bbox->advance_width, "OO check");