From PHP documentation:
Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.
Try adding this before your code:
putenv('GDFONTPATH=' . realpath('./YOUR_SUB_DIRECTORY'));