Project

General

Profile

Bug #20603 » 11310_v2.diff

Administrator Admin, 2010-08-05 01:33

View differences:

t3lib/class.t3lib_stdgraphic.php (working copy)
$breakWidth = $conf['breakWidth'];
$breakSpace = $this->getBreakSpace($conf);
//Bounding box is needed for total image width
if ($conf['align'] == 'right' || $conf['align'] == 'center') {
$boundingBox = $this->calcBBox($conf);
}
$wordPairs = $this->getWordPairsForLineBreak($string);
// Iterate through all word pairs:
foreach ($wordPairs as $index => $wordPair) {
......
$currentWidth+= $wordWidth;
$phrase.= $wordPair;
} else {
// Render the current phrase that is below breakWidth:
$this->ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $phrase, $splitRendering, $sF);
//Recalc width to skip trailing blanks
$currentWidth = $this->getRenderedTextWidth(trim($phrase), $conf);
// Render the current phrase that is below breakWidth - set x position depending on alignment:
$this->ImageTTFTextWrapper($im, $fontSize, $angle, ($conf['align'] == 'right' ? $boundingBox[0] - $currentWidth + $x : ($conf['align'] == 'center' ? ($boundingBox[0] - $currentWidth) / 2 + $x : $x)), $y, $color, $fontFile, trim($phrase), $splitRendering, $sF);
// Calculate the news height offset:
$y+= $breakSpace;
// Restart the phrase:
......
}
// Render the remaining phrase:
if ($currentWidth) {
$this->ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $phrase, $splitRendering, $sF);
$this->ImageTTFTextWrapper($im, $fontSize, $angle, ($conf['align'] == 'right' ? $boundingBox[0] - $currentWidth + $x : ($conf['align'] == 'center' ? ($boundingBox[0] - $currentWidth) / 2 + $x : $x)), $y, $color, $fontFile, trim($phrase), $splitRendering, $sF);
}
} else {
$this->ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $sF);
(4-4/4)