Site logo

[Resolved] Implement custom font but don't correct

Home Forums Support [Resolved] Implement custom font but don't correct

Home Forums Support Implement custom font but don't correct

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #720847
    John Maui

    Hi,

    My font is geomanist (http://atipofoundry.com/fonts/geomanist) and I try to implement custom font but the font don’t show correct. Although i can choose font from Customizer.

    I do exactly like https://docs.generatepress.com/article/adding-local-fonts/ but it’s not show correct.
    Here ist example from style.css in child theme

    @font-face {
        font-family: 'geomanist';
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.eot');
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.woff2') format('woff2'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.woff') format('woff'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.ttf') format('truetype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.svg#geomanistregular') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    
    @font-face {
        font-family: 'geomanist';
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.eot');
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.woff2') format('woff2'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.woff') format('woff'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.ttf') format('truetype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.svg#geomanistitalic') format('svg');
        font-weight: normal;
        font-style: normal;
    }

    And here is the functions.php in child theme (only the adding code)

    add_filter( 'generate_typography_default_fonts', 'tu_add_local_fonts' );
    function tu_add_local_fonts( $fonts ) {
        $fonts[] = 'geomanist';
        return $fonts;
    }

    I have also read the other topic like https://generatepress.com/forums/topic/implement-custom-font/. So please don’t send me somethings like that ๐Ÿ™‚

    My website ist vinaloka.com and you can see text in https://www.vinaloka.com/verkehr/mit-dem-zug-durch-vietnam.html
    Please help me !
    Thanks for your reading ๐Ÿ™‚

    #720874
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The issue is that you’re visiting your site using www, but the URLs in your child theme have no www.

    Browsers will block fonts if the URLs don’t match. So if you add www to the calls in your child theme, it will work ๐Ÿ™‚

    #721031
    John Maui

    Dear Tom,
    How can i add www to the calls in my child theme ?
    Thanks
    Vinh

    #721165
    Leo
    Staff
    Customer Support

    Tom is referring to the code you have in the original topic:

    @font-face {
        font-family: 'geomanist';
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.eot');
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.woff2') format('woff2'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.woff') format('woff'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.ttf') format('truetype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-webfont.svg#geomanistregular') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    
    @font-face {
        font-family: 'geomanist';
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.eot');
        src: url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.woff2') format('woff2'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.woff') format('woff'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.ttf') format('truetype'),
             url('https://vinaloka.com/wp-content/themes/generatepress_child/fonts/geomanist-regular-italic-webfont.svg#geomanistitalic') format('svg');
        font-weight: normal;
        font-style: normal;
    }

    The URLs hasve no www.

    #721387
    John Maui

    Ah ok. I have checked it and now it works now ๐Ÿ™‚
    Thanks for your support ๐Ÿ™‚
    Vinh Pham

    #722005
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.