Site logo

Archived topic

trouble integrating two part font from typography.com

13 replies · Started by Drew on February 16, 2018

Viewing posts 1–14 of 14

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?

Many thanks,
Drew

Hi Drew,

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!

Hi Tom,

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.

Suggestions?

Drew

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.

Drew

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_stack filter to make it so the "System Stack" font actually outputs your own custom font stack.

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).

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.

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.

Can you share the code they're trying to use?

Let me see if he's still online, if not, I'll follow up once I touch base with him again.

He wants to give it another shot but I'll post what he has if he continues to run into any issues. Many thanks!

Sounds good :)

Okay, this seems to have done the trick now. Many thanks for your help :)

You're welcome! :)

This archived topic is closed to new replies.