changing font options after customizing a theme
Permalink
We've run into a bit of an odd scenario here working on a theme.
1. The theme had a few custom fonts (google web fonts in this case) available through the theme customizer.. let's say font_a was chosen
2. The theme developer has decided to change what fonts to use in the theme and would like to use font_b
3. The presets/defaults.less and build/fonts/defaults.less files were updated to reflect this.
4. The end user goes to the theme customizer and font_a is still selected (not a big deal), however font_b does not show up in the list of option. Clearing the site cache / removing any .lesscache files, etc does not make font_b show up in the list
The only way I have found to refresh the list of font options is to clear ALL customized styles.
Ideally there would be a way to trigger a font option refresh or something to make sure that the options are current. It's entirely possible I'm missing something but has anyone else run into this?
Thanks!
1. The theme had a few custom fonts (google web fonts in this case) available through the theme customizer.. let's say font_a was chosen
2. The theme developer has decided to change what fonts to use in the theme and would like to use font_b
3. The presets/defaults.less and build/fonts/defaults.less files were updated to reflect this.
4. The end user goes to the theme customizer and font_a is still selected (not a big deal), however font_b does not show up in the list of option. Clearing the site cache / removing any .lesscache files, etc does not make font_b show up in the list
The only way I have found to refresh the list of font options is to clear ALL customized styles.
Ideally there would be a way to trigger a font option refresh or something to make sure that the options are current. It's entirely possible I'm missing something but has anyone else run into this?
Thanks!
One real limitation of the style customizer right now is its lack of font customization. We just have a hard coded list of fonts. Whatever the [b]current[/b] font is in the stylesheet will be honored and saved, but nothing else will. So you can't really specify your own custom list of fonts (at least not more than one) to be available through the customizer. That's a limitation that we ought to fix, we're just trying to figure out the best way.
Would having a method in page_theme.php like
be a reasonable solution? It would have it's drawbacks (if different presets utilize different fonts the end user would always have all of the options), but it may be a fairly straight forward to implement rather than parsing less files looking for referenced fonts?
Just a thought...
public function getThemeCustomFonts() { return array( 'my-font' => 'My Font', 'another-font' => 'Another Font' ); }
be a reasonable solution? It would have it's drawbacks (if different presets utilize different fonts the end user would always have all of the options), but it may be a fairly straight forward to implement rather than parsing less files looking for referenced fonts?
Just a thought...
I was also thinking it could be a custom concrete5 LESS function, like the concrete-icon LESS function. Then you'd define how to load these files in the fonts.less file (which you already do.) – it just knows to load the fonts themselves in the font picker from the LESS function.
I'm so glad to discover that you recognize the need for enhancing font options. I have been reading blog.hubspot.com/marketing/elements-of-modern-web-design-list, and the first item it lists as critical to making a website unique, in addition to serving as a tool to help "lead readers to different parts" of a website, is typography. The current handful of fonts hard-wired into 5.7 makes it impossible to create a site that stands out. So I would certainly urge the tireless team there to consider making this a priority. (Kudos and thanks to the team for the fantastic job it is doing.)
Just as an aside, I note that one of the typefaces that is available is Comic Sans. This font is described at http://www.pcworld.com/article/2030201/killing-comic-sans-5-alterna... as causing a site to look amateurish.
Just as an aside, I note that one of the typefaces that is available is Comic Sans. This font is described at http://www.pcworld.com/article/2030201/killing-comic-sans-5-alterna... as causing a site to look amateurish.