Archived topic
Google font problem
12 replies · Started by Krzysztof on October 14, 2016
After update GP Premium to 1.2.90 and GP theme to 1.3.40 I have problem with Google font on my site. Before update font was linked by:
<link rel='stylesheet' id='generate-fonts-css' href='//fonts.googleapis.com/css?family=Roboto:100,100italic,300,300italic,regular,italic,500,500italic,700,700italic,900,900italic&subset=latin-ext' type='text/css' media='all'/>
Now I see:
<link rel='stylesheet' id='generate-fonts-css' href='//fonts.googleapis.com/css?family=Roboto&subset=latin-ext' type='text/css' media='all' />
Where is definition for font weight? How to fix it?
Same wired thins in code, e.g. inline style for H1 after update:
h1 {
font-family: "Roboto",;
font-weight: 300;
text-transform: uppercase;
font-size: 21px;
}
And this same before:
h1 {
font-family: "Roboto", sans-serif;
font-weight: 300;
text-transform: uppercase;
font-size: 21px;
}
Where is sans-serif now? This update just ruined my page :/
First problem fixed itself by editing and seveing theme options again BUT link to Google font still look strange:
<link rel='stylesheet' id='generate-fonts-css' href='//fonts.googleapis.com/css?family=Roboto:100,100italic,300,300italic,regular,italic,500,500italic,700,700italic,900,900italic|Roboto&subset=latin-ext' type='text/css' media='all' />
Hi there,
The way the theme gets the font variants and categories improved drastically in the latest version.
The category and variants should have populated on first load of your Dashboard (typically after the update).
It didn't for you, which could be caused by using a child theme with manual filters for the fonts - not sure if that's the case?
As for the second issue, are you using any custom functions dealing with the fonts?
Tom, I use my own child theme and I don't see category and variants. I use only filter "generate_fonts_subset" to add "latin-ext".
Can you share you code so I can test it?
I sent it in the email to You. Anyway, I found in my child theme have missing some options in filter "generate_font_option_defaults" (font_body_category and font_body_variants), I added it and there is no changes in look.
Those are the new fields.
Before, every time you loaded your page GP looked through all of the Google Fonts and grabbed the variants and category.
Now, those values are set once, so we don't have to look at 800+ fonts. Very happy with this change.
Looks like making some adjustments to the child theme functions have fixed this issue :)
@Tom, where information about font_body_variants is stored? I changed it from "100,100italic,300,300italic,regular,italic,500,500italic,700,700italic,900,900italic" to "100,100italic,300,300italic,regular,italic,500,500italic" and in page source still is previous value...
When you select fonts in the Customizer, two hidden fields are automatically populated with the data attached to the font you choose.
For now, these fields will stay hidden, but the variants might become visible one day.
For now, you can do this:
add_action('customize_controls_print_styles', 'tu_customize_preview_css');
function tu_customize_preview_css() {
?>
<style>
.customize-control.customize-control-gp-hidden-input {display: block !important;}
</style>
<?php
}
That will display the fields so you can adjust them as needed.
It's required to have something in each field.
Hope this helps!
The problem is that I don't use Customizer, I just updated child theme setting via php. Any way, I deleted theme options in database (field theme_mods_{theme-name}) and now my changes works.
Let me know if that works long term - there is a method in place that automatically sets them based on your chosen font if nothing exists in those fields.
However, that shouldn't happen if you have your font set in the defaults function along with the variants for that font.