Black Friday Sale! Get up to $30 off GP Premium! Learn more ➝

[Resolved] trouble integrating two part font from typography.com

Home Forums Support [Resolved] trouble integrating two part font from typography.com

Home Forums Support trouble integrating two part font from typography.com

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #498185
    drew

    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

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #498378
    Tom
    Lead Developer
    Lead Developer

    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!

    #498418
    drew

    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

    #498432
    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

    #498609
    Tom
    Lead Developer
    Lead 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_stack filter to make it so the “System Stack” font actually outputs your own custom font stack.

    #498932
    drew

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

    #498995
    Tom
    Lead Developer
    Lead 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.

    #498996
    drew

    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.

    #498999
    Tom
    Lead Developer
    Lead Developer

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

    #499000
    drew

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

    #499034
    drew

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

    #499282
    Tom
    Lead Developer
    Lead Developer
    #500387
    drew

    Okay, this seems to have done the trick now. Many thanks for your help πŸ™‚

    #500791
    Tom
    Lead Developer
    Lead Developer
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.