开发者

PHP GD Font Width Calculate Help

OK a little background story. I am redesigning one of my old websites and I want to use Myriad Pro for the title on the page. This will be dynamic with PHP, etc.

At first I thought I should just use CSS styles and define Myriad as the main font. But after using typetester.org, I found that Myriad and let's say Arial are different heights even if they are the same font size.

So 开发者_如何学JAVAI could use CSS and risk breaking my design in browsers without the font...

So then I thought I could use sIFR. (Whatever it's called LOL)

At last I decided to use PHP GD.

Which brings me to my question:

Is it better to set a fixed image width large enough to accommodate lots of text within GD or to dynamically calculate the images width according to the amount of characters.

If the second one is better, how would I calculate the width of a non fixed width font like Myriad?

PS, I don't know if my server supports ImageMagick so GD solutions only please.

PPS, What is another way I can use Myriad Pro that doesn't resort to GD?


There's a function for that.

I've been using cufón for text replacing instead of sIFR because it uses JavaScript instead of Flash and it worked beautifully. You need to generate a JS font from the TTF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜