Project

General

Profile

Actions

Bug #21054

closed

GMENU - first menu item does not appear because of wrong calulation of text position

Added by Sonja Schubert over 14 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-09-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The fist menu item does not appear, but always only the first.

The problem occours because of the wrong calculation of the text position in tslib_gifBuilder::ImageTTFBBoxWrapper

If you call the following function all in this function simply twice it works:
$calc = ImageTTFBBox(t3lib_div::freetypeDpiComp($sF*$strCfg['fontSize']), $angle, $fontFile, $strCfg['str']);

I have checked the image proccessing menu point in the install tool with the following result:

TYPO3 4.2.8
ImageMagick enabled: 1
ImageMagick path: (6.3.7)
ImageMagick path/LZW: (6.3.7)
Version 5/GraphicsMagick flag: im5

GDLib enabled: 1
GDLib using PNG: 0
GDLib 2 enabled: 0
IM5 effects enabled: 0 (Blurring/Sharpening with IM 5+)
Freetype DPI: 96 (Should be 96 for Freetype 2)
Mask invert: 0 (Should be set for some IM versions approx. 5.4+)

File Formats: gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai

The testmenu items all works fine exclude the following:
GD libary functions:
- Render text with TrueType font using 'niceText' option
- Render 'niceText' with a shadow under
(issue imported from #M11954)


Files

21054.patch (709 Bytes) 21054.patch Albrecht Köhnlein, 2011-07-11 14:32
Actions #1

Updated by Andreas Wolf over 14 years ago

What exactly does not look correct on the rendered test images? Does it help to set Freetype DPI to 72? Which PHP/GD version are you using? Try to enable usage of GD version 2 and check the result again.

Actions #2

Updated by Christian Bernet over 14 years ago

We have exactly the same error. The rendered test images looked right. php: 5.2.6, freetype: 2.3.7, libgd2. The use of GD Version 2 is enabled. The label of the first item wich has "align = center" in a GMENU will not be drawn.
We have another error: if we have the typoscript: "dimensions = [10.w]+16,0,3,18" we get a fatal error. it's in different typo3 versions, from 4.0.4 trought 4.2.9. it was after a upgrade from debian etch to the lenny version.

Actions #4

Updated by Albrecht Köhnlein almost 13 years ago

Yes, it's a PHP bug, but here is a tiny bugfix/workaround for those who can't fix their PHP.

The problem are the negative values, returned from PHP function ImageTTFBBox

Array
(
    [0] => -1
    [1] => 0
    [2] => -2147483648
    [3] => 0
    [4] => -2147483648
    [5] => -26
    [6] => -1
    [7] => -26
)

Because the wrong values do not appear always, it helps to recalculate until the value is correct. So I changed

$calc = ImageTTFBBox(t3lib_div::freetypeDpiComp($sF*$strCfg['fontSize']), $angle, $fontFile, $strCfg['str']);

into

do {
    $calc = ImageTTFBBox(t3lib_div::freetypeDpiComp($sF*$strCfg['fontSize']), $angle, $fontFile, $strCfg['str']);
} while($calc[2] < 0);

in file class.t3lib_stdgraphic.php

Actions #5

Updated by Mr. Hudson almost 13 years ago

Patch set 1 of change I6c1548e0f8762d6c2befdd47dbfb7810b01c9508 has been pushed to the review server.
It is available at http://review.typo3.org/3281

Actions #6

Updated by Mr. Hudson almost 13 years ago

Patch set 3 of change I6c1548e0f8762d6c2befdd47dbfb7810b01c9508 has been pushed to the review server.
It is available at http://review.typo3.org/3281

Actions #7

Updated by Mr. Hudson almost 13 years ago

Patch set 4 of change I6c1548e0f8762d6c2befdd47dbfb7810b01c9508 has been pushed to the review server.
It is available at http://review.typo3.org/3281

Actions #8

Updated by Mr. Hudson over 12 years ago

Patch set 5 of change I6c1548e0f8762d6c2befdd47dbfb7810b01c9508 has been pushed to the review server.
It is available at http://review.typo3.org/3281

Actions #9

Updated by Albrecht Köhnlein over 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Gerrit Code Review over 12 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-4 has been pushed to the review server.
It is available at http://review.typo3.org/7120

Actions #11

Updated by Gerrit Code Review over 12 years ago

Patch set 2 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/7119

Actions #12

Updated by Albrecht Köhnlein over 12 years ago

  • Status changed from Under Review to Resolved
Actions #13

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF