- This topic has 13 replies, 2 voices, and was last updated 3 years, 9 months ago by Tom.
February 16, 2018 at 7:01 am #498185drew
Hi Tom, my programmer asked me to ask about a solution for how to handle a custom font delivered by typography.com that delivers the files in a two-part system (Gotham A and Gotham B).
While we can get Part A and Part B to appear separately using GP’s filters, we can’t figure out how to combine them so they deliver typography.com’s single Gotham font family.
Do you have any insight on how that is accomplished?
DrewGeneratePress 2.0.2GP Premium 1.5.6February 16, 2018 at 10:50 am #498378TomLead DeveloperLead Developer
If they’re two separate fonts, they would need to be added separately I believe. It depends on how the @font-face declaration is set up. If two different font-family blocks are required, then two different font names need to be added.
Hope that makes sense!February 16, 2018 at 11:55 am #498418drew
The problem is that we need to be able to select one font from the typography font select, but it has to be able to apply two font faces.
The way typography.com delivers fonts, in order to maintain some amount of security against file theft, they split the font into two files with some characters in one and some in the other. (I think this is how it works anyway.)
To use the Gotham font, it requires a style rule that looks like this:
font:bold 45px/1.2em "Gotham A","Gotham B";
Note the fallback from one to the other.
When we used the filters ion our previous platform (WooThemes’ Canvas) to add a Gotham entry to their selects, we edited the font list in a filter like this:
$fonts['"Gotham A", "Gotham B"'] = 'Gotham';
Woo used the array index as the font-family and the array value as the label to show in the select.
In GeneratePress, the filter that does that same job looks something like this:
$fonts = '"Gotham A", "Gotham B"';
(That doesn’t work, nor does it if the quotes are HTML-escaped.)
The above gets us a label of “Gotham A” (including the quotes) and doesn’t apply a typeface. So we need a way to have a single entry in the select box apply that kind of multiple-font-family setting. It’s not clear how we do that or if it’s even possible the way this is written.
I did try the Woo method of index and label and that doesn’t work. We do get just Gotham in the select, but it only applies a font-family of “Gotham”, which isn’t how typography.com does it.
DrewFebruary 16, 2018 at 12:27 pm #498432drew
Good news here, I think my programmer may have found the issue: https://www.screencast.com/t/4dpgJiyW4or6
It’s the “don’t want you wrapping quotes around values” bit.
Would it be possible to get the following mod:
typography.php, line 537 is where he creates the array
After it, include:
$no_quotes = apply_filters('generate_typography_no_quotes', $no_quotes);
My programmer thinks this would address the issue without impacting any of the standard functionality or needing to use a child theme.
DrewFebruary 16, 2018 at 9:02 pm #498609TomLead DeveloperLead Developer
That would definitely be a good filter to have – I’ll get that added in.
For now you might be able to alter the
generate_typography_system_stackfilter to make it so the “System Stack” font actually outputs your own custom font stack.February 17, 2018 at 8:40 am #498932drew
Interesting, I’ll run that past my programmer. Otherwise, if he added that filter manually for now and you do include it in the next release, we should be fine there as well (let me know if you think otherwise).February 17, 2018 at 9:46 am #498995TomLead DeveloperLead Developer
The next release is quite close, so it may not make it into that one. Let me know if the system stack filter doesn’t work for some reason.February 17, 2018 at 9:48 am #498996drew
I actually just heard back from my programmer just as your note came in and it looks like that option isn’t working out unfortunately.February 17, 2018 at 9:50 am #498999TomLead DeveloperLead DeveloperFebruary 17, 2018 at 9:54 am #499000drew
Let me see if he’s still online, if not, I’ll follow up once I touch base with him again.February 17, 2018 at 10:55 am #499034drew
He wants to give it another shot but I’ll post what he has if he continues to run into any issues. Many thanks!February 17, 2018 at 9:46 pm #499282TomLead DeveloperLead DeveloperFebruary 19, 2018 at 9:51 am #500387drew
Okay, this seems to have done the trick now. Many thanks for your help 🙂February 19, 2018 at 9:29 pm #500791
- You must be logged in to reply to this topic.