[% nodes.$node.data.textwidth = nodes.$node.data.width %] [% USE gd = GD.Image(nodes.$node.data.width,nodes.$node.data.height); %] [% gd.trueColor(1); %] [% USE wrapbox = GD.Text.Wrap(gd, line_space => 4, text=> nodes.$node.data.text, ); %] [% wrapbox.font_path(basePath _ "/Templates/fonts"); %] [% wrapbox.set_font(nodes.$node.data.font,nodes.$node.data.tsize); %] [% bounds = wrapbox.get_bounds(0,0) %] [% nodes.$node.data.height = bounds.3 %] [% xpos = (nodes.$node.data.width - nodes.$node.data.textwidth) %] [% IF xpos >0 %] [% xpos = xpos / 2; %] [% END %] [% USE gd2 = GD.Image(nodes.$node.data.width,nodes.$node.data.height); %] [% gd2.trueColor(1); %] [% bgcol = gd2.colorAllocate(nodes.$node.data.bgcol.r, nodes.$node.data.bgcol.g, nodes.$node.data.bgcol.b); %] [% gd2.fill(1,1,bgcol); %] [% IF nodes.$node.data.trans == "1" %] [% gd2.transparent(bgcol); %] [% END %] [% fgcol = gd2.colorAllocate(nodes.$node.data.fgcol.r,nodes.$node.data.fgcol.g,nodes.$node.data.fgcol.b); %] [% USE wrapbox2 = GD.Text.Wrap(gd2, line_space => 4, color => fgcol, text=> nodes.$node.data.text, ); %] [% wrapbox2.font_path(basePath _ "/Templates/fonts"); %] [% wrapbox2.set_font(nodes.$node.data.font,nodes.$node.data.tsize); %] [% wrapbox2.set(align => 'left', width => nodes.$node.data.textwidth); %] [% wrapbox2.draw(xpos, 0); %] [% gd2.png | stdout(1); %]