Inside-Depth Guide to host local locale fonts on WordPress

Nov 25, 2022
local fonts wordpress

What is Web Fonts?

  • Web fonts are fonts which are not compatible with the device and require downloading via the user's browser before display. Examples of web fonts are Google's Open Sans and Roboto font along with the popular Proxima Nova font from Adobe Fonts.
Google font stats
Google font stats

Hosting Local Fonts vs 3rd Party

The benefits of fonts that are local

1. More Fonts to Choose from

One of the greatest advantages local fonts provide is that they have access to the vast selection of choices when it comes to the fonts you can choose to choose from! While 3rd party service providers such as Google Fonts and Adobe Fonts offer a wide variety of fonts however, they are not as good as top-quality font stores, where you are able to purchase each premium web font that you would like to use on your website. The font we'll be using is an official font for our instruction below that cannot be found through any third-party services.

2. It is possible to make it more integrated

With the wide range of fonts that are available, local hosting can allow the user to choose a font that is more compatible to the style you've chosen to ensure consistency throughout your website. Everything boils down to design choices and needs.

3. Do not have to depend on 3rd Party Services

If you host your fonts on your own, you don't have to rely on third-party services and their server. These services, such as Adobe Fonts (previously Typekit) are known to shut down, which then, results that your website appears not professional. With fewer dependents on your WordPress website is always better.

https://t.co/Kde0okKlP0#customfontssuck#3rdpartyjs
November 17 17, 2015

4. Total Control of Caching

google fonts specify a cache validator
Indicate a cache validator

5. More Requests = faster load Times

google font requests
Google Font HTTP requests

6. A Connection with HTTP/2

The advantages and disadvantages of Local Fonts

We've talked about the advantages of using local fonts locally However, there are disadvantages to be conscious of.

1. Google Fonts can be cached already

Google Fonts makes use of its own CDN which is extremely speedy since they are Google and not Google. Because a large number websites utilize Google Fonts, it could likely be that the user already is using the font within their memory of the browser they use. If you select a unique premium, premium font it can improve download speed. When, for example, somebody visits a website which uses the Roboto font available via Google Fonts, it will save into the cache. If they later access the site that utilizes Roboto then the font does not require download at this point. If however, you're using a newly released premium font such as Proxima Soft, it will almost certainly require download to avoid an indefinite delay when loading.

One of the most important aspects in this case is that if you opt to utilize costly fonts that aren't widely used, then you must be prepared for the user's browser being required to download it every time they visit your site. Be aware that if you're using the most well-known Google font and are hosting it locally, as with Roboto the rule doesn't hold since the browser is intelligent enough to locate it within its cache (whether it's downloaded from Google or your local site).

2. Complexer

It is a fact that not all users are WordPress professional. Hosting local fonts definitely takes a little more setup. In the example above the WordPress theme can use Google Fonts automatically in their theme. If you host local fonts, then you'll need a way to prevent their use in your site. This could entail having the creator of the theme to ask for simple lines of code. It may be difficult to do, however we'll try to make it as easy as is possible, with the help of the below steps.

3. It is important to pay attention to font choices

woff 2 browser support
WOFF2 browser support

If you're using an outside party and are working with a third-party and you're unable to work since they're providing a variety of options for support for various browsers straight from the beginning. If you're hosting locally, you have to be very careful about the type of font you choose.

4. Do not do this without CDN

How can I make and manage Local Fonts in WordPress

Now is the time for the fun phase! hosting your local fonts on WordPress. Two different alternatives below. The first is using a premium font that we purchased. It is the other, using an already-existing Google font and hosting the font locally. This guide will show you how to do this. are using a brand new WordPress installation, using Twenty Seventeen as the Twenty Seventeen theme.

1. How can you host high-quality local fonts?

To host a high-quality font locally, we chose to use Fontspring along with the brand new Proxima Soft font which debuted in January 2017. Proxima Nova Soft designed by Mark Simonson, is a updated variant of the Proxima Nova font. We chose Fontspring as they do not require third-party tracking software as well as the feature the fact that Fontspring is a one-time purchase that can be utilized across many websites. Be careful when searching for Fontspring, since many of them require third-party tracking software that in some way is against the point of local hosting of the font.

fontspring
Fontspring

We bought the Proxima Soft Regular as well in Proxima Soft Bold and Proxima Soft Bold fonts. Regular fonts and bold is sufficient for most websites. If your site isn't well-known it's possible to obtain an italics font and semi-bold. Please note that we don't have any affiliation with Fontspring We just believe Fontspring offers premium fonts and licenses right!

Do you want to know what steps we have taken to increase the number visitors we receive by 1000 percent?

Join the more than 20,000 who get our weekly emails. We'll show you tips and tricks from the inside! WordPress tricks!

Step 1.

When you've paid for your fonts, you'll be sent the email that contains links to your font file.

proxima soft download
Proxima Soft font download

Step 2.

Each font version that is accessible such as bold and regular, will have distinct types of fonts like WOFF2, WOFF, WOFF2 in addition to WOFF2. For this particular example is based on the WOFF along with the WOFF2 fonts for regular and bold fonts for complete browser compatibility.

font files local
Local font documents

Step 3.

We take the font files and then upload them via FTP on our WordPress site to the directory we have named "fonts." This time we're using our CDN for all of our files, as well as the free CDN enabler plugin by the folks at KeyCDN. It replicates the fonts we've uploaded onto our CDN. Even though they're stored locally, the fact that they're hosted on a CDN doesn't mean that it does not refer to the local resources. It is important to remember that you're providing all your assets with the same address and are not linking to different hostnames (hosts).

local fonts ftp
Uploading fonts to the webserver

Step 4.

It's crucial to link to the brand-new fonts within CSS for your WordPress site. Many themes come with an CSS panel that's distinctive, or you can utilize an open-source plugin such as Simple Custom CSS or JS. In this instance you will have to add the following code and refer directly to the CDN URL.

@font-face font-family: 'proxima_softregular'; src: url('https://cdn.wpdev.ink/fonts/proximasoft-regular-webfont.woff2') format('woff2'), url('https://cdn.wpdev.ink/fonts/proximasoft-regular-webfont.woff') format('woff'); font-weight: normal; font-style: normal; @font-face font-family: 'proxima_softbold'; src: url('https://cdn.wpdev.ink/fonts/proximasoft-bold-webfont.woff2') format('woff2'), url('https://cdn.wpdev.ink/fonts/proximasoft-bold-webfont.woff') format('woff'); font-weight: normal; font-style: normal; 

Also, you'll need to alter your style towards the font family that is new. This is an example of how we've applied the look to our Twenty Seventeen theme.

body font-family: 'proxima_softregular', Arial, sans-serif; h1,h2,h3,h4,h5,h6 font-family:'proxima_softbold', Arial, sans-serif;

This is an example that uses the Simple Custom CSS and JS plugin.

custom local fonts css code
CSS fonts can be described as fonts created by hand

Step 5

If you're WordPress theme has Google Fonts already built into it, you'll have to disable Google Fonts. In the event that you don't, you could be loading local fonts as well as using Google Fonts. As we're using this theme, called the Twenty Seventeen theme in this tutorial, we're using the free disablement from the Google Fonts plugin. It is only available for themes which are pre-installed on WordPress. For the majority of themes, you will probably have to get in touch with the creator of the theme. They'll give you a way to deactivate Google fonts. Or check their documentation, usually, this is an easy change. Certain themes let you toggle the theme off or on in the backend.

Then, that's all! Screenshot of the new Proxima Soft font that is loaded to the body font, as and the headers for The Twenty Seventeen theme.

new fonts on wordpress site
New fonts have been added to the WordPress website

Here is a screen shot of one of our HTTP requests. You can see that there only two requests to download WOFF2 fonts, in place of four request from Google like we mentioned previously. The WOFF fonts are through the website, however, because Chrome can support WOFF2, they're loaded instead. When we visit the site using IE 11 for example, WOFF fonts will be loaded instead.

local fonts loading
HTTP requests for locally hosted fonts

2. How can I manage hosting Google Fonts Locally

Another option for hosting locally-hosted fonts is to pick one that you enjoy in Google Fonts and transfer it to your computer or CDN. Open Sans is known to extremely light and fast. We'll utilize Open Sans for our testing.

Step 1.

The best way to grab the Google Fonts is to use the free google-webfonts-helper tool, which we are using for this tutorial. You may also want to check out this Font Face Observer project. One of the first steps you'll need to accomplish is locate that Google Font you want, and select the font's style. Then, you'll be able to select both the standard and large (700) styles of the font.

download open sans font
Free Download Open Sans web font

Step 2.

Following that, you'll have to select the browser that supports you. The most modern browsers can support the WOFF and WOFF2 typefaces, and they're what we're looking for. An excellent support package contains WOFF, WOFF2 TTF, SVG, and. The package includes the code that you'll be able to save to your clipboard along with the zip file that includes the fonts.

fonts modern browsers
CSS fonts to be used with modern browsers

The remaining instructions adhere to the same format used in the premium fonts sample we previously provided.

3.

The fonts are downloaded, and then upload them through FTP on our WordPress site to a folder we created named "fonts." This is because we're making use of the CDN to host all our resources. This goes in addition to the cost-free CDN Allower plug-in provided by the team at KeyCDN. It copies fonts automatically that we've migrated onto our CDN. Although we claim to host them locally but the CDN doesn't yet have a reference to local assets. It's important to remember that you're hosting all of your assets in the same place, instead of using multiple hosting providers (hosts).

upload google fonts server
Transfer Google Fonts to webserver

Step 4

There is a need for linking to new fonts using CSS in your WordPress site. Many themes come with the ability to customize CSS panels as well as a free plugin like Simple CSS or JS. CSS and JS. This code is in the code to reference it to the CDN URL.

/* open-sans-regular - latin */ @font-face font-family: 'Open Sans'; font-style: normal; font-weight: 400; src: local('Open Sans'), local('OpenSans'), url('https://cdn.wpdev.ink/fonts/open-sans-v13-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ url('https://cdn.wpdev.ink/fonts/open-sans-v13-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ /* open-sans-700 - latin */ @font-face font-family: 'Open Sans'; font-style: normal; font-weight: 700; src: local('Open Sans Bold'), local('OpenSans-Bold'), url('https://cdn.wpdev.ink/fonts/open-sans-v13-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ url('https://cdn.wpdev.ink/fonts/open-sans-v13-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ 

Also, you will have to modify your design to show the most recent font family. Here is an example of the that we utilized on the Twenty Seventeen theme.

body font-family: 'Open Sans', Arial, sans-serif; h1,h2,h3,h4,h5,h6 font-family:'Open Sans', Arial, sans-serif;

Below is a screenshot of the plugin: Simple custom CSS and it's JS plugin.

custom css local fonts open sans
CSS that is local stored locally Open Sans font

Step 5

If your WordPress theme comes with Google Fonts already integrated into it, you'll need to turn them off. It could be funny, because we're making use of Google fonts. The reason we do this is to stop external requests. As we're using Twenty Seventeen theme in this video, we've opted to make use of the no-cost disabling Google Fonts plugin. It's compatible with only the default themes available for download on WordPress. For the vast majority of themes it's probable that you will have to contact the designer to get them to provide an option to disable Google fonts. Additionally, you should read their help manual. It is usually a straightforward switch. Some themes provide the option of turning off the feature or switch them on in the end of the procedure.

It's that! This is a screen shot of our most recent Google Open Sans font loading onto our body font along with our headers on Our Twenty Seventeen theme.

example local fonts open sans
An example from the Open Sans font hosted locally

This is a screen capture of the request. It's clear that there are two requests to get WOFF2 fonts instead , rather than Google's 4 requests which were displayed earlier. The WOFF fonts can be found on the website too, however because Chrome can support WOFF2, the fonts will be employed rather. If we had visited the website with IE 11 for example, WOFF's fonts could have been replaced.

open sans http requests
Open Sans HTTP requests

Summary

We'd like to know what your settings are. Do you use a third company service for loading your fonts to the internet ? Have already tried hosting locally?

Make it easier to save time, money, and enhance site performance:

  • Assistance is immediately available from WordPress hosting specialists, 24 hours a day.
  • Cloudflare Enterprise integration.
  • Reaching a global audience with 35 data centers spread across the globe.
  • Optimization through the built-in Application Performance Monitoring.

This article was originally posted here

Article was first seen on here