FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using imagettfbbox with Arial Bold
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using imagettfbbox with Arial Bold [message #173364 is a reply to message #173277] Tue, 05 April 2011 03:27 Go to previous message
jwcarlton is currently offline  jwcarlton
Messages: 76
Registered: December 2010
Karma:
Member
>> OK, that makes sense. What I don't get, though, is why it's not
>> measuring correctly based on the way I've coded it? Like Natural said
>> (below), isn't it the same library rendering it for the screen as is
>> doing the measurement?
>
> You never said that you are comparing the output of imagettfbbox() with
> a real picture of the font (PNG or something) generated with GD.
> Actually, you suggested you are comparing it with the font as rendered
> by the browser.
>
> :-?

You're right, I'm just an idiot :-) I am comparing text rendered by
the browser to text rendered by GD. I just got confused.

I did fix the problem, though, based on your earlier comment.

What I was doing was creating a variable-driven navigation bar, then a
variable-driven submenu beneath each title. For this purpose, I was
using text, then padding left and right by 15px to make it centered.
Then, using imagettfbbox(), I was measuring the width, then adding 30
to it to make the submenu the same width as the parent title.

The CSS padding is where the problem came in. To fix this problem, I
measured the width first, then added 30px to it to set the width of
the title, then centering the text; essentially removing the padding
altogether.

So basically, I made the width of the title the same as the width of
the submenu, instead of trying to make the submenu the same width as
the title.

Too much info, I know. But in the end, it's fixed, so I thank you very
much for your help :-)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Firefox PHP error report
Next Topic: OpenSSL support => disabled (install ext/openssl)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 08:39:34 GMT 2024

Total time taken to generate the page: 0.04990 seconds