Permalink
Browse files

properly test UTF8 handling for FT1, and fix it

  • Loading branch information...
1 parent 405c810 commit e3b4d6c3b1e0e31bd4cca02fad77014911b346a9 @tonycoz committed Feb 25, 2013
Showing with 7 additions and 12 deletions.
  1. +4 −4 Imager.xs
  2. +3 −8 lib/Imager/Font/Truetype.pm
View
@@ -2235,7 +2235,7 @@ MODULE = Imager PACKAGE = Imager
undef_int
-i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
+i_tt_text(handle,im,xb,yb,cl,points,str_sv,smooth,utf8,align=1)
Imager::Font::TT handle
Imager::ImgRaw im
i_img_dim xb
@@ -2250,19 +2250,19 @@ i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
char *str;
STRLEN len;
CODE:
+ str = SvPV(str_sv, len);
#ifdef SvUTF8
if (SvUTF8(str_sv))
utf8 = 1;
#endif
- str = SvPV(str_sv, len);
RETVAL = i_tt_text(handle, im, xb, yb, cl, points, str,
len, smooth, utf8, align);
OUTPUT:
RETVAL
undef_int
-i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
+i_tt_cp(handle,im,xb,yb,channel,points,str_sv,smooth,utf8,align=1)
Imager::Font::TT handle
Imager::ImgRaw im
i_img_dim xb
@@ -2277,11 +2277,11 @@ i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
char *str;
STRLEN len;
CODE:
+ str = SvPV(str_sv, len);
#ifdef SvUTF8
if (SvUTF8(str_sv))
utf8 = 1;
#endif
- str = SvPV(str_sv, len);
RETVAL = i_tt_cp(handle, im, xb, yb, channel, points, str, len,
smooth, utf8, align);
OUTPUT:
@@ -3,7 +3,7 @@ use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Imager::Font);
-$VERSION = "1.011";
+$VERSION = "1.012";
*_first = \&Imager::Font::_first;
@@ -44,21 +44,16 @@ sub _draw {
my $self = shift;
my %input = @_;
- # note that the string length parameter is ignored and calculated in
- # XS with SvPV(), since we want the number of bytes rather than the
- # number of characters, which is what we'd get in perl for a UTF8
- # encoded string in 5.6 and later
-
if ( exists $input{channel} ) {
Imager::i_tt_cp($self->{id},$input{image}{IMG},
$input{'x'}, $input{'y'}, $input{channel}, $input{size},
- $input{string}, length($input{string}),$input{aa},
+ $input{string}, $input{aa},
$input{utf8}, $input{align});
} else {
Imager::i_tt_text($self->{id}, $input{image}{IMG},
$input{'x'}, $input{'y'}, $input{color},
$input{size}, $input{string},
- length($input{string}), $input{aa}, $input{utf8},
+ $input{aa}, $input{utf8},
$input{align});
}
}

0 comments on commit e3b4d6c

Please sign in to comment.