Bug #20603
closed
align center with breakSpace and breakWidth
Added by bilal over 15 years ago.
Updated about 11 years ago.
Description
i have a gmenu. in the gmenu i also have this code:
10.align = center
10.offset = 0,15
10.breakWidth = 150
10.breakSpace = 1.2
but the code doesnt generate the result i want. i think its a bug in the new feature 'breakspace/breakwidth'.
the result im getting is attached in this message.
the result i WANT: to position the first 2 lines ('keuzewijzer' and 'persoonlijke') in the center.
is it a bug or am i doing something wrong?
(issue imported from #M11310)
Files
Please add the whole TypoScript that generates the mentioned image.
The breakSpace just defines a maximum width - however this has no absolute meaning that could be used to position an element centered or right aligned.
Hi Oliver,
this is the code...
temp.menu-level-1 < temp.menu-level-0
temp.menu-level-1.entryLevel = 1
temp.menu-level-1.1 = GMENU
temp.menu-level-1.1 {
NO.wrap = <li class="submenu"> | </li>
NO.stdWrap.htmlSpecialChars = 1
NO {
XY = 185,[10.h] + 10
backColor = #000000
10 = TEXT
10.text.field = title
10.fontFile = fileadmin/sitedesign/layouts/standaard/BlockBE-Condensed.otf
10.fontSize = 16
10.fontColor = #FFFFFF
10.align = center
10.offset = 0,17
10.breakWidth = 150
10.breakSpace = 1.2
}
ACT < .NO
ACT = 1
ACT.wrap = <li class="submenu">|</li>
ACT.stdWrap.htmlSpecialChars = 1
ACT {
XY = 185,[10.h] + 10
10.backColor = #000000
10 = TEXT
10.text.field = title
10.fontFile = fileadmin/sitedesign/layouts/standaard/BlockBE-Condensed.otf
10.fontSize = 16
10.fontColor = #FFED00
10.align = center
10.offset = 0,17
10.breakWidth = 150
10.breakSpace = 1.2
}
}
regards,
bilal :-)
edit: this is the new gmenu, with the correct font, etc.
[img]http://img29.imageshack.us/img29/1809/gmenufont.gif[/img]
we're a couple of days further now...
is there someone out there who has a solution for this bug?
I encountered the same issue. The problem is that when using breakWidth in conjunction with align center/right, the x position where the text is drawn is not recalculated for each new line.
I added a patch to class.t3lib_stdgraphic.php, that extends the renderTTFText method, so that the x position is calculated individually for each new line, based upon the alignment.
It works perfectly for me, although integration into the stdGraphic lib probably could be more generic.
Regards,
Wolfgang
Hmm. I just installed your patch. Awesome.
However, it creates an additional issue: offset and workArea don't seem to work with the fix. Here's my TS:
10 = IMAGE
10.file = GIFBUILDER
10.file {
format = gif
// quality = 100
XY = 900, 520
transparentBackground = true
backColor < globalMenu.1.NO.ATagParams.stdWrap.cObject.10.file.backColor
workArea = 401, 69, 363, 196
30 = TEXT
30 {
offset = 0,80
align = center
iterations = 3
niceText = 1
breakWidth = 300
fontSize = 55
fontFile = {$templavoila_framework.skinPath}/fonts/INKCALIG.TTF
fontColor < globalMenu.1.NO.ATagParams.stdWrap.cObject.10.file.20.fontColor
text.cObject = RECORDS
text.cObject {
tables = tt_content
conf.tt_content = TEXT
conf.tt_content.field = bodytext
source = tt_content_{$slogan.source}
}
}
}
10.wrap = <div id="home-brand">|</div>
I included " + $x " in two lines (copies of the same line in two spots) of your patch and that fixes it for me:
$this->ImageTTFTextWrapper($im, $fontSize, $angle, ($conf['align'] 'right' ? $boundingBox[0] - $currentWidth + $x : ($conf['align'] 'center' ? ($boundingBox0 - $currentWidth) / 2 + $x : $x)), $y, $color, $fontFile, trim($phrase), $splitRendering, $sF);
I had to apply your patch manually because I'm using Typo3 v4.4 (beta), so let me know if you'd rather I do a diff file.
Updated patch to apply against current trunk and included Jacob's suggestion. Works well in my very limited testing :)
- Status changed from Needs Feedback to Accepted
- Target version deleted (
0)
- Complexity set to medium
Someone around who wants to push the patch to gerrit?
- Status changed from Accepted to Needs Feedback
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
- Status changed from Needs Feedback to Closed
- Is Regression set to No
No feedback for over 90 days.
Also available in: Atom
PDF