Here for the community? On May 9th, we'll be in New Orleans. Don’t miss out!
There are more Google fonts now. Maybe it's better let user to input the font name rather than select in limited options.
Instead in 7.x-3.x I built integration with @font-your-face module which solves many issues, it gives access to all Google fonts, font variants (such as Latin and Greek), previews and handles all the font loading itself.
I think this could work if the user is not inputting the font name but rather the entire link element as supplied by Google Fonts, e.g.:
<link href='http://fonts.googleapis.com/css?family=Audiowide&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
That I think can work, this gives access to all character sets and removes the necessity to maintain a list, and removes a tonne of code from 7.x-3.x.
The one very small issue with this is supporting https, however user can simply change the protocol to suit, I think this can work.
I will test with various ideas around this, how to make this clean and workable. I usually dislike working with strings and user input at this level but I can see if I can make this work in a sensible way.
This runs into some pretty immediate issues:
So, I think the original idea of adding the Font Name only could be the way to go, we have never provided a way to declare a fall back font-family for these fonts, aka inputting cursive, sans serif etc, so I don't see that as a major issue we really need to deal with.
I'm gonna test with just the Font name and see how that goes, there is substantial code for supporting this in the theme already and would get us away from having to deal with strings really late in the page request, we can use drupal_add_css() in our normal google font loader, albeit with some modifications (and likely performance benefits).
Right now I am pretty sold on this, its a good idea, despite my initial reluctant feelings.
I committed an implimentation to DEV, it uses the Font name and allows for adding extra styles and character sets. I am reasonably happy with it:
- like the new flexibility, styles, character sets and its faster (better performance)
- dislike the added complexity and additional form elements
Its a trade off, more complexity for more flexibility, although I would like to keep an open mind to the UI and see if we can reduce the complexity of it even more, to make it less intimidating to new users but not loose any of the features.
Done, had good feedback from some other users and this is working pretty good. Its going forward and into the RC today.
Drupal is a registered trademark of Dries Buytaert.