I am currently trying to install php-font-lib in joomla, i have been working with custom libraries in joomla for the last 3 hours, So I have absolutely no idea whats going on.

I have Joomla 3.3.

I have gotten it to kind of work, if i remove the namespacing from a file and call it via: jimport('fontlib.Font');

then i tried the following: JLoader::registerNamespace('FontLib', JPATH_LIBRARIES . '/fontlib/');

but i still can not seem to call the Font class.

Is there something I am doing incorrectly?

Any Help Greatly Appreciated.


1 Answer 1


There are two ways you can do it.

I copied php-font-lib in the path shown in the image below.

enter image description here

Using jimport (with basically just replaces dots with slashes), you can choose to use the Autoloader provided by php-font-lib, which might decouple you nicely from Joomla.


$font = \FontLib\Font::load('Norasi.ttf');

Using the Joomla Autoloader

JLoader::registerNamespace('FontLib', JPATH_LIBRARIES . '/php-font-lib/src/');

$font = \FontLib\Font::load('Norasi.ttf');


  • Wow, Thank you... went with using jimport.. the Joomla Autoloader didn't work out..
    – user404
    May 18, 2014 at 8:58
  • Nice to hear that. JLoader should have worked as well, tested myself in 3.3. Anyway, glad I could help. May 18, 2014 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.