Calculating Text Width with PHP GD
I'm simply trying to get the width of a dynamic line of text for addition to an image generated with GD PHP. I'm a little unsure how though. I know how to load a font using imageloadfont(), but can I use a .ttf file? I want to know the width of text using size 12 arial font. When I try to use my ttf file I get the error "Error reading font, invalid font header." If I need a .gdf file, where can I find a font size 12 gdf file? Here's my code: $newfont = imageloadfont("../fonts/arial.ttf"); $font_width = imagefontwidth($newfont); $font_height = imagefontheight($newfont); imageloadfont() is used