PHP TTF / PNG image generation (font) issues

Hi guys,

I’m having issues with generating images using PHP’s native TTF/PNG functionality.

The problem relates to a specific font.
When trying to render the new font is returns what’s shown in the attachment problem.png.
I’ve tried several others and they all render perfectly fine, generating as characters, etc.

There are two possibilities that I can think of. One is the font that’s corrupt so I’ve requested the font file again just incase it’s corrupt, however it renders perfectly fine in Photoshop and Illustrator. The second, I may be missing a some sort of parameter.

The images are generated using a separate PHP script from the page on which the images are present, IE the image url is ./generate/newimage.php as opposed to a standard jpg path etc.
The script uses output buffering to ensure that there is no ‘crap’ output which could hinder the rendering process.
The font files presence is verified using file_exists() then the image is generated using relevant functionality, mainly native PHP functionality.
The process in which the images are generated cannot be changed at this time due to dead lines so that option is completely off the cards at the moment.

The font is a script font with lots of curly bits :lol: similar to Snell Roundhand which renders perfectly fine when used with the existing functionality.

I cannot share the ttf file due to licensing, etc.

Any pointers would be great.

Great, so you’ve narrowed it down to two likely issues. Unfortunately, you have not given us anything to confirm/rule out either of them. For the first possibility, if you can, could you find an alternative font file that a) also doesn’t work, b) you’re allowed to distribute so that we can run code with the same file? For the second possibility, without seeing the “parameters” being used we cannot help to determine if you may be missing something.


Thanks for your reply.
By parameters I meant things like PHP flags.
The script works perfectly fine, it’s been used for years on our site and works with a vast array of fonts.
I’ve tested it with 20+ fonts this morning and all rendered perfectly fine.

I’m still waiting for the new font file.

The main reason for the posting was to see if there were any flags which are required for more script/handwritten fonts, or are all fonts handled regardless of their appearance?