• Hi,

    I need to include the theme’s fonts (Oswald, Noto Sans, Josefin Slab) from our own server instead of loading them from the Google server.

    I already downloaded the font files from Google and put them in the new created folder “fonts” in my child theme.

    I found the file where the source of the fonts is indicated:
    …\wp-content\themes\origamiez\inc\functions.php (Line 1152 to 1157)

    But I don’t know exactly how to change the code. Can you help with that? Can it be done in a way so that it won’t be overrided with next theme update?

    Thank you
    Merle

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Alex Kalh

    (@colourstheme)

    Hi friend,

    If you don’t want load google fonts from Google’s server. Please follow guide:

    1. Open file /inc/functions.php
    Find and remove 2 block codes:

    a. Line from 1152 – 1156 (default fonts)
    b. Line from 1174 – 1180 (fonts has been added from Customizer)

    NOTE:
    Please update version 1.3.0 before do it.

    Best regards,
    Alex Kalh

    Thread Starter cityfox

    (@cityfox)

    Hi Alex,

    I wish you a Happy New Year! All the best for you and your family!

    For the Google font issue:

    If I remove the 2 block codes the site doesn’t load the font files from my child theme. So I tried this:

    1) File origamiez/inc/functions.php

    a. Line from 1152 – 1156:

    I changed the code to:

    //GOOGLE FONT
        $font_groups['default'] = array(
    		'oswald' => '/wp-content/themes/cocomero/fonts/google-fonts.css?family=Oswald:400,700&subset=latin,vietnamese',
    
            'noto-sans' => '/wp-content/themes/cocomero/fonts/google-fonts.css?family=Noto+Sans:400,400italic,700,700italic&subset=latin,vietnamese',
    
    		'josefin-slab' => '/wp-content/themes/cocomero/fonts/google-fonts.css?family=Josefin+Slab:400,400italic,700italic,700',
        );

    b. Line from 1174 – 1180:

    I didn’t change this code.

    2) I created a folder called “fonts” in my child theme and there I put:

    a. Folders “josefinslab”, “notosans” and “oswald” with font files (that I downloaded from Google)

    b. a css file called “google-fonts.css” with this code:

    /* latin */
    @font-face {
      font-family: 'Josefin Slab';
      font-style: normal;
      font-weight: 400;
      src: local('Josefin Slab'), local('JosefinSlab'), url(josefinslab/46aYWdgz-1oFX11flmyEfegdm0LZdjqr5-oayXSOefg.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
    }
    /* cyrillic-ext */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/C7bP6N8yXZ-PGLzbFLtQKRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
    }
    /* cyrillic */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/iLJc6PpCnnbQjYc1Jq4v0xJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
    }
    /* devanagari */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/5pCv5Yz4eMu9gmvX8nNhfRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+02BC, U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200B-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
    }
    /* greek-ext */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/gEkd0pn-sMtQ_P4HUpi6WBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+1F00-1FFF;
    }
    /* greek */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/iPF-u8L1qkTPHaKjvXERnxJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+0370-03FF;
    }
    /* vietnamese */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/mTzVK0-EJOCaJiOPeaz-hxJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
    }
    /* latin-ext */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/erE3KsIWUumgD1j_Ca-V-xJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
      unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'Noto Sans';
      font-style: normal;
      font-weight: 400;
      src: local('Noto Sans'), local('NotoSans'), url(notosans/LeFlHvsZjXu2c3ZRgBq9nFtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
    }
    /* latin-ext */
    @font-face {
      font-family: 'Oswald';
      font-style: normal;
      font-weight: 400;
      src: local('Oswald Regular'), local('Oswald-Regular'), url(oswald/yg0glPPxXUISnKUejCX4qfesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
      unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'Oswald';
      font-style: normal;
      font-weight: 400;
      src: local('Oswald Regular'), local('Oswald-Regular'), url(oswald/pEobIV_lL25TKBpqVI_a2w.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
    }

    This works for Chrome and Firefox but not for the Internet Explorer. Unfortunately lot of my colleagues still use the Internet Explorer. Do you have an idea what I can do to make it work in the Internet Explorer?

    Thanks so much,
    Merle

    Theme Author Alex Kalh

    (@colourstheme)

    Hi friend,

    Please try syntax:

    @font-face {
    font-family: ‘Oswald’;
    src: url(‘oswald.eot’); /* IE9 Compat Modes */
    src: url(‘oswald.eot?#iefix’) format(’embedded-opentype’), /* IE6-IE8 */
    url(‘oswald.woff2’) format(‘woff2’), /* Super Modern Browsers */
    url(‘oswald.woff’) format(‘woff’), /* Pretty Modern Browsers */
    url(‘oswald.ttf’) format(‘truetype’), /* Safari, Android, iOS */
    url(‘oswald.svg#svgFontName’) format(‘svg’); /* Legacy iOS */
    }

    Best regards,
    Alex Kalh

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to load fonts from own server instead of loading from google server’ is closed to new replies.