Taking Requests: Get your preferred Google Font in the Fordson theme!

Taking Requests: Get your preferred Google Font in the Fordson theme!

by Chris Kenniburg -
Number of replies: 10
Picture of Plugin developers

Hello All,

I am busy prepping the next release of the Fordson theme and need your help.  A brand new feature will be a drop-down for Google Fonts.  If you would like a certain font from the list at google please let me know before the end of the week.  

https://fonts.google.com/

Please reply with the link to the font such as " https://fonts.google.com/specimen/Krona+One "

I'll be checking back here and try to include all the fonts in the drop-down as long as it doesn't get to be too long of a list!

Attachment Moodle 3 4  Administration  Appearance  Themes  Fordson.png
Average of ratings: Useful (1)
In reply to Chris Kenniburg

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

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

Hi Chris,

I rather like Cabin: https://fonts.google.com/specimen/Cabin.

G

In reply to Gareth J Barnard

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Chris Kenniburg -
Picture of Plugin developers

Thanks Gareth.  I have it added.

In reply to Chris Kenniburg

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Richard Oelmann -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chris,

In the past (flexibase) I've done this kind of thing as a free text entry for the font name and another one for the weights/styles where needed, then used that to construct the URL (and the font-family css rule) so that the user - or at least the site administrator as it is a theme setting - can choose any Google font they wanted to and if the font lists (or design tastes) change, I wouldn't have to update the theme every time.

I haven't tried it with Boost yet, but I think it worked quite well in Flexibase

https://developers.google.com/fonts/docs/getting_started#a_quick_example

https://github.com/roelmann/moodle-theme_flexibase

In reply to Richard Oelmann

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Chris Kenniburg -
Picture of Plugin developers

This would provide the ultimate in flexibility but could also cause some issues if it isn't put in the text field correctly.  I think I had something similar in Pioneer but it was clunky.  

I am stumped on how to add the second part of the font such as serif, sans-serif, cursive, monospace, etc.  

Any ideas on this?


In reply to Chris Kenniburg

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Richard Oelmann -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

If you are providing them as a drop down list, then you could use a keyed array as you will know all the variables

$fontsarray(
    fontname1 => fonttypeA,
    fontname2 => fonttypeA,
    fontname3 => fonttypeB,
    fontname4 => fonttypeA,
)

Then you use that as 

$fonttypeforurl = $fontsarray['userselectedfont']
In reply to Chris Kenniburg

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Richard van Iwaarden -
Picture of Particularly helpful Moodlers

Awwww... you missed my request for PT Sans sad


Any hopes for the next realease? smile

In reply to Richard van Iwaarden

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Chris Kenniburg -
Picture of Plugin developers

Hey Richard,

It's still experimental. Some fonts worked well and others seemed to have no impact and I believe that is because of the way I bring them into the theme.   

So, in short... I'm still learning how to best do this. 

Chris

In reply to Chris Kenniburg

Re: Taking Requests: Get your preferred Google Font in the Fordson theme!

by Richard van Iwaarden -
Picture of Particularly helpful Moodlers

OK Thanks! It's not really a problem for me, when I add one line of html to the head section and one line of CSS, I still have the PT Sans.

If I can help with anything just let me know.