Search code examples
phpfontsopentype

Generate image with PHP using 0 with a slash through it


I'm trying to generate an image with PHP using functions like: imagecreatefrompng, imagettfbbox, imagettftext

All good, I'm able to generate the image. One issue that I have is that need the following sentence:

Hi. 0 is a nice number.

I need that 0 to be with a slash through it. Pretty much like the 0 on the top right of this image.

enter image description here

An alternative would be to edit the font I guess.


Solution

  • You've pretty much nailed the answer in your question. You just need to use a font that has the 0 with the line in (or modify a font file if inclined) - then you'll be all good.