summaryrefslogtreecommitdiff
path: root/lib/GridFiller/Result/Pango.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2010-12-22 16:00:16 +0000
committerdakkar <dakkar@thenautilus.net>2010-12-22 16:00:16 +0000
commitc91d953548557f7c82396498ea8d33821afba5ed (patch)
tree26ceef9933bfe5b1f755182f36b51e206339ef9a /lib/GridFiller/Result/Pango.pm
parentcenter in both directions (diff)
downloadqr-builder-c91d953548557f7c82396498ea8d33821afba5ed.tar.gz
qr-builder-c91d953548557f7c82396498ea8d33821afba5ed.tar.bz2
qr-builder-c91d953548557f7c82396498ea8d33821afba5ed.zip
center in color runs
Diffstat (limited to 'lib/GridFiller/Result/Pango.pm')
-rw-r--r--lib/GridFiller/Result/Pango.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/GridFiller/Result/Pango.pm b/lib/GridFiller/Result/Pango.pm
index 47a08c0..1172848 100644
--- a/lib/GridFiller/Result/Pango.pm
+++ b/lib/GridFiller/Result/Pango.pm
@@ -190,13 +190,13 @@ sub string_height {
}
sub _center_adj {
- my ($self,$p) = @_;
+ my ($self,$p,$space) = @_;
my ($w,$h) = $p->get_pixel_size;
my $size = $self->cell_size;
my $w_rounded = ceil($w/$size)*$size;
- my $w_adj = ceil(($w_rounded-$w)/2);
+ my $w_adj = ceil(($space*$size+$w_rounded-$w)/2);
my $h_adj = ceil(($size - $h)/2);
return $w_adj,$h_adj;
@@ -216,7 +216,7 @@ sub colour_for_string {
my $PI=3.1415926;
sub place_word_at {
- my ($self, $word, $x, $y, $dir) = @_;
+ my ($self, $word, $space, $x, $y, $dir) = @_;
$self->log->debug("Placing $word at ${x}:${y} ($dir)");
@@ -226,7 +226,7 @@ sub place_word_at {
my $cr = $self->_cairo_c;
$x*=$size;$y*=$size;
- my ($w_adjustment,$h_adjustment) = $self->_center_adj($p);
+ my ($w_adjustment,$h_adjustment) = $self->_center_adj($p,$space);
$cr->save;
if ($dir == $HORIZONTAL) {