Error: "font was not found, sorry."

Error: "font was not found, sorry."

by Plum Bum -
Number of replies: 8

Hi,

i implemented webfonts like it is described in this documentation but I only get the error message: "font was not found, sorry." When implementing the webfont like

url([[font:theme|fontfile.woff]]);

I'll get an error. Implementing it via the absolute or relative path like

url('themename/fonts/fontfile.woff');

everything works fine.

I'm working with Moodle 3.3+ (Build20170616) and while it would be possible to work with a real path I would prefer the Moodle way.

So pleas help, if somebody knows a solution. Thanks!


Average of ratings: -
In reply to Plum Bum

Re: Error: "font was not found, sorry."

by Gareth Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

url('themename/fonts/fontfile.woff'); does not look correct as should be 'url('theme/themename/fonts/fontfile.woff');' or is that what you meant?

also, what file did you put 'url([[font:theme|fontfile.woff]]);' in?  Is that file in the list of CSS files used by the theme?

In reply to Gareth Barnard

Re: Error: "font was not found, sorry."

by Plum Bum -


url('themename/fonts/fontfile.woff'); does not look correct as should be 'url('theme/themename/fonts/fontfile.woff');' or is that what you meant?

No, because this ist the working part.


also, what file did you put 'url([[font:theme|fontfile.woff]]);' in?  Is that file in the list of CSS files used by the theme?

Yes, the CSS-file is correct implemented and working. Other CSS-Styles (like the one above) are working fine also. As I described in my initial post only the syntax as described in the moodle docs is not working:

url([[font:themename|fontfile.woff]]); == not working (but recommended by Moodle docs)

url('themename/fonts/fontfile.woff'); == working (usual syntax with relative path)


To be clear: It's not a how-to-get-this-to-work-in-general question, it's more like a is-it-a-bug question and how to solve it as recommended in the Moodle docs.

English is not my native language so I apologize, if my wording is not as precise as intended. : )



In reply to Plum Bum

Re: Error: "font was not found, sorry."

by Gareth Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, if the file was in the correct place then 'url('themename/fonts/fontfile.woff'); == working (usual syntax with relative path)' would not work but "url('theme/themename/fonts/fontfile.woff');'" should.

And I believe that the Moodle docs are correct and you're doing it wrong.

And I do need to ask 'what' CSS file as the styles might be working but this syntax is specific and needs to be processed correctly.  i.e. it will not normally work in a LESS file.

In reply to Plum Bum

Re: Error: "font was not found, sorry."

by Mary Evans -

Hi, to put you right I have to say that you are wrong in assuming the URL for fonts is

url([[font:themename|fontfile.woff]]); == not working (but recommended by Moodle docs)

This is totally WRONG!!!

It should read:

url([[font:theme|sillyfontname.ttf]])

where 'theme' is all encompassing and is the word THEME and NOT the name of YOUR theme. So go away and re-read the Moodle Doc:

How to add custom fonts in a theme

and then only comeback when you have got it working.

Thanks

Mary

PS: Visual example: From my own theme called Morecandy

https://github.com/lazydaisy/moodle-theme_morecandy/blob/master/style/font-awesome.css#L7-L16

In reply to Mary Evans

Re: Error: "font was not found, sorry."

by Plum Bum -

Hi Mary,

altough your answer sounds very rude to me („go away …“) it gratefully included the missing link.

I misinterpreted font:theme. I thought I had to replace theme with the actual themename. Now everything works fine.

After all, I only had the example from the link of my first post and I think there is more room for misinterpretation then in the link you provided.

So „totally WRONG!!!“ as you shouted, is a bit of an overstatement. I didn't want to offend anyone, needed just a little help.

However, thanks for the quick solving. Patrick


Average of ratings: Useful (2)
In reply to Plum Bum

Re: Error: "font was not found, sorry."

by Mary Evans -

Sorry, Patrick,

I get carried away every now and again...it can be a little stressful here as we are all on a learning curve, and its annoying when things are not as streightforward as they could be, especially when I wrote that Document! Moodle Docs! Bah humbug!

Anyway you deseve a cheer...so here it is!

Cheers

Happy Moodling

Please call in again if you get stuck with anything Theme oriented.

Cheers

Mary

In reply to Mary Evans

Re: Error: "font was not found, sorry."

by Plum Bum -

You are forgiven. : )

And the rest of the documentation was top-notch. ; )

All the best

Patrick

Average of ratings: Useful (1)