[reportlab-users] registering font does not work after switching media server

Thomas Kremmel thomasspin at gmail.com
Thu Mar 25 08:36:58 EDT 2010


Oh yes... that helped! Thank you. That saved my working day ;-)

2010/3/25 Andy Robinson <andy at reportlab.com>


> On 25 March 2010 11:31, Thomas Kremmel <thomasspin at gmail.com> wrote:

> > Tried it like this:

> > pdfmetrics.registerFont(TTFont('Calibri',

> > 'my_project/media/fonts/calibri.ttf'))

> > or

> > pdfmetrics.registerFont(TTFont('Calibri-Bold',

> > 'media/fonts/calibri-bold.ttf'))

> > But anyway, thats more a server question, than a reportlab question ;-)

>

> You need to provide an absolute path. Otherwise, it looks relative to

> the 'current working directory'; if doing "manage.py runserver" that's

> inside your project code, but inside Apache it could be '/' or

> somewhere else unpredictable.

>

> All our settings.py files tend to have a variable MEDIA_DIR set to the

> disk location of the files, rather than the URL; we'd build the full

> pathname to the fonts using this.

>

> Hope this helps,

>

> Andy

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100325/575f0be6/attachment-0001.html>


More information about the reportlab-users mailing list