Using Any Font

Using Any Font

by Fran San -
Number of replies: 1

Hi all,

I'm a beginer developing in moodle. I am trying to use a custom font on my index page. Many times I 've used @font-face to do this.

@font-face { font-family: 'CustomFont'; src: url('fonts/MyFontFile.ttf');}


I don´t know clearly where I can insert the @font-face.

Could be in style folder?  (theme/mytheme/style).

Thank you so much in advance, I'm a little bit lost.

Average of ratings: -
In reply to Fran San

Re: Using Any Font

by David Scotson -
I found your post while searching for info on how to do this. If you put the fonts directory inside your theme then try:

'../theme/name_of_your_theme/fonts/MyFontFile.ttf'

This seems to be at least half working for me. Though I seem to recall I tried something similar to link to a javascript file and there were some locations in Moodle that were one folder deeper than the rest, and in those areas it couldn't find my javascript.

I got around the javascript thing by using "new moodle_url('/theme/blah/blah/blah')" and for pictures generally you can use [[pix:theme|blah]] and it'll look in the pix folder inside your theme.

However, [[font:theme|MyFontFile.ttf]] doesn't seem to work, for me at least,

regards,

dave

PS (You might get better answers in the Themes discussion, perhaps someone will move your question there?)
Average of ratings: Useful (1)