-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typography: Ability to load all/multiple variants of the font while keeping CSS output as it is #992
Comments
I agree with @rahulnever2far. We must provide better typography selection process for users providing them less choice. Similar question is asked here #885, and to reference this #903 where user reached for the not-so-happy solution.
|
@aristath Is it possible to load specific variants of a font programmatically? As I stated in my first post, I'm trying to load four generic variants of the body font defined using @dariodev In my opinion, it going to be very complex to code all that especially because options of all the typography fields would need to be updated each time Font Family and Subsets would be updated. If you want them to be updated in real-time without reloading the Customzier, it would need to be done using javascript and it won't perform well if there are a lot of typography fields. Even for the user, it would be somewhat confusing. How about a simpler approach, define two global
|
Marked as a feature request. |
No problem. We appreciate the time and effort you put into Kirki :) |
I've been thinking of a way to implement this... The reason I won't be doing this just yet is because I want to move the implementation back to select2 (currently using selectize). But implementing any more changes to the typography control at this point would only mean we'd have to rewrite it again once we transition to select2. |
Ideally, and I apologize for repeating other requests, I'd love to see typography work like this: body font choose the variants/weights With a limited choice from the fonts I choose as some google fonts are crappy Then have the ability to add more Typography fields for the other areas like widget titles the site title with all the fonts available or just some funky ones I choose. Right now, I have select field choosing just the fonts for the entire site, but for the Site Title, if they don't have an image, I'm using a Typography field and sadly the google font used in the select is also added in the css output of the Typography field. It doesn't mess up design, but it looks bad in the code. |
@carasmo I don't get it.... |
A type of typography field for where the theme dev can choose google fonts to add with weights and variants so that body is 400 (example) and if strong is used then the bold font is used (if it's there). Then the regular typography field as it is. I'm kind of doing that now with select. |
So... in other words, allow selecting multiple values for font-weights, correct? I still believe that users should not be able to select multiple font-weights in a typography control. As a user, I see a control that says for example "Select typography options for your body" I hope the above makes some sense... So I wouldn't want to allow selecting multiple font-weights. BUT I'm not rejecting the idea.... We could add an extra argument that would allow developers to specify if a typography control can load extra variants.
But... doesn't that get a bit too complicated again?? Alternative: Personally I prefer to programmatically define force-loaded subsets in a typography control... |
As for filtering the available fonts, I agree with that idea. |
Filtering font-families is now possible on a per-control basis. |
Added to the 3.0 milestone, I hope I'll have time to implement the improvements discussed above and find a way to make it all work. |
Actually this was simpler than expected... 'choices' => array(
'variant' => array(
'regular',
'italic',
'700',
'700italic'
),
), |
I have a plugin (add on for Kirki) allow load all or multiple variants. Hope this plugin useful for you. |
Load all font variants
|
I have a
typography
field to select the base font of the theme. It is tried to thebody
tag. As it is base font, usual variants of the font (regular, italic, bold and bold italic) should be loaded because people use those variants in post content. However, CSS output should be as it is.I'm familiar with
Kirki_Fonts_Google::$force_load_all_variants = true;
. But I don't all variants of all typography fields to load because that would have a serious impact on theme's load time.I'm suggesting something like this:
The text was updated successfully, but these errors were encountered: