fix some problems in handling glyph dimensions with freetyp2.c
authorTony Cook <tony@develop=help.com>
Wed, 15 Aug 2001 00:39:33 +0000 (00:39 +0000)
committerTony Cook <tony@develop=help.com>
Wed, 15 Aug 2001 00:39:33 +0000 (00:39 +0000)
problem with sizew parameter
problem with handling of canon option to bounding_box

freetyp2.c
lib/Imager/Font.pm
lib/Imager/Font/FreeType2.pm

index 0a2b96a94267ad62da3ee539bb283361b7d88a77..507078430803fa3ac41891df5e7cfcda283e7f57 100644 (file)
@@ -299,9 +299,9 @@ i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth,
   }
 
   bbox[0] = start;
-  bbox[1] = handle->face->size->metrics.ascender / 64;
-  bbox[2] = width + start;
-  bbox[3] = handle->face->size->metrics.descender / 64;
+  bbox[1] = handle->face->size->metrics.descender / 64;
+  bbox[2] = width;
+  bbox[3] = handle->face->size->metrics.ascender / 64;
   bbox[4] = descent;
   bbox[5] = ascent;
 
index 1d0716cc0ead14a2c49270d47c63e3743c5f8aff..5f0e004e8d262d4e1f0b5a57116ba6da5266c551 100644 (file)
@@ -147,6 +147,7 @@ sub bounding_box {
     return;
   }
   $input{size} ||= $self->{size};
+  $input{sizew} = _first($input{sizew}, $self->{sizew}, 0);
 
   my @box = $self->_bounding_box(%input);
 
@@ -156,7 +157,7 @@ sub bounding_box {
     $box[3]=$input{'y'}-$gdescent;     # bottom = base - descent (Y is down, descent is negative)
     $box[0]+=$input{'x'};
     $box[2]+=$input{'x'};
-  } elsif (exists $input{'canon'}) {
+  } elsif ($input{'canon'}) {
     $box[3]-=$box[1];    # make it cannoical (ie (0,0) - (width, height))
     $box[2]-=$box[0];
   }
index c0d9bce686ebbcf4c9ea7cef8c1668ac11c4d09d..1f1a7746f9177d8216c4f3910a8e40d62ce71509 100644 (file)
@@ -58,6 +58,7 @@ sub _draw {
 sub _bounding_box {
   my $self = shift;
   my %input = @_;
+
   return i_ft2_bbox($self->{id}, $input{size}, $input{sizew}, $input{string});
 }