GD-Text-Arc

 view release on metacpan or  search on metacpan

Arc.pm  view on Meta::CPAN

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
my @widths;
my $total;
my @letters = split //, $self->get('text');
 
#######################################################################
# for character x, width(x) is not useful because .ttf fonts
#   account for kerning.  width(x1) + width(x2) + width(x3)
#   is categorically different from width(x1.x2.x3).
#
# By process of elimination: an OK formula to find width(x2):
#   assume x1 is a space, and perform:
#   width(x1.x2.x3) - (width(x1) + width(x3)).
#
# If x2 is a space, make it wider; if it is (A|C|V) make it narrower.
#
# Whew.  This should probably be simplified.
#######################################################################
 
foreach my $n (0..$#letters) {
    my $nextLetter = $letters[$n+1] || " ";



( run in 0.480 second using v1.01-cache-2.11-cpan-0d8aa00de5b )