Largura de fonte exata do PHP

Eu estou tentando gerar uma imagem de texto.

Então eu crio uma nova fonte:

   $font = '../fonts/Arial.ttf';

Então eu adiciono alguns antecedentes para o texto

   imagefilledrectangle($image, 0, 0, ?, 12, $green);

E adicionar texto

   imagettftext($image, 12, 0, 0, 12, $white, $font, $text);

O problema é agora eu não sei como obter a largura da minha fonte com tamanho 12.

Obrigado.

questionAnswers(1)

yourAnswerToTheQuestion