Subject: | the bounding box values for a string containing only spaces is strange |
Using the T1 with some fonts gives strange results for the values
derived from T1_GetStringBBox when the string is empty, or for some
fonts when the string contains only spaces.
Also, if the string has spaces at the beginning or end the spaces are
not included in the bbox, which may not be a bug, but is inconsistent
with the ft2 driver and probably the tt driver.
use Imager;
use strict;
use warnings;
my $font = "hll_____.pfb";
my $ifont = Imager::Font->new(file => $font, size => 36) or die "$font: $!";
foreach my $string ("", " ", " ", "a", "a ", " a") {
print qq{"$string"\t};
my $bbox = $ifont->bounding_box(string => $string);
print join ", ", ($bbox->font_height,
$bbox->total_width,
$bbox->start_offset,
$bbox->global_descent);
print "\n";
}