{"id":4533,"date":"2022-08-01T09:59:24","date_gmt":"2022-08-01T15:59:24","guid":{"rendered":"https:\/\/wpengine.com\/builders\/?p=4533"},"modified":"2024-01-04T08:42:20","modified_gmt":"2024-01-04T14:42:20","slug":"font-techniques-wordpress-themes","status":"publish","type":"post","link":"https:\/\/wpengine.com\/builders\/font-techniques-wordpress-themes\/","title":{"rendered":"Font Techniques for Modern WordPress Themes"},"content":{"rendered":"\n<p>For the last few years, fonts on the web have been a rather significant bottleneck for performance. This impacts our end users. Typography choices are imperative to providing a consumable experience, but at what cost?<\/p>\n\n\n\n<p>Let&#8217;s explore some font techniques that can help us offer a faster experience in our WordPress themes.<\/p>\n\n\n\n<div class=\"wp-block-group has-polar-background-color has-background is-layout-flow wp-container-core-group-is-layout-464b1fb5 wp-block-group-is-layout-flow\" style=\"padding-top:1.25rem;padding-bottom:1.25rem\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-e088cbc5 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-outermost-icon-block items-justified-undefined\"><div class=\"icon-container has-icon-color\" style=\"color:#7e5cef;width:38px\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M10 11c-1.588-.479-4-.91-4-.91s2-.241 4-.454c1.8-.191 3.365-.502 4-3.181C14.635 3.775 15 1 15 1s.365 2.775 1 5.455c.635 2.679 2 2.969 4 3.181 2 .213 4 .455 4 .455s-2.412.43-4 .909c-1.588.479-3 1-4 4.546-.746 2.643-.893 4.948-1 5.454-.107-.506-.167-2.5-1-5.454C13 12 11.588 11.479 10 11zM7.333 3.5C6.803 3.333 6 3.182 6 3.182s.667-.085 1.333-.16c.6-.066 1.122-.175 1.334-1.113C8.878.971 9 0 9 0s.122.971.333 1.91c.212.937.667 1.038 1.334 1.113.666.074 1.333.159 1.333.159s-.804.15-1.333.318c-.53.167-1 .35-1.334 1.59C9.085 6.017 9.036 6.824 9 7c-.036-.177-.056-.875-.333-1.91-.334-1.24-.804-1.423-1.334-1.59zM2.444 18C1.474 17.713 0 17.454 0 17.454s1.222-.145 2.444-.272c1.1-.115 2.057-.302 2.445-1.91C5.277 13.666 5.5 12 5.5 12s.223 1.665.611 3.273c.388 1.607 1.222 1.781 2.445 1.909 1.222.127 2.444.273 2.444.273s-1.474.258-2.444.545c-.971.287-1.834.6-2.445 2.727-.456 1.586-.546 2.97-.611 3.273-.065-.304-.102-1.5-.611-3.273C4.278 18.6 3.415 18.287 2.444 18z\"><\/path><\/svg><\/div><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>The more you know!<\/strong><\/p>\n<\/div>\n\n\n\n<p>A common misconception is that <code>@font-face<\/code> is what triggers a font to be downloaded. However, it is not until the font is used that it actually called, e.g. <code>h1, h2, h3, h4, h5, h6 { font-family: \"Open Sans\"; }<\/code><\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Static &amp; Variable fonts<\/h2>\n\n\n\n<p>Variable fonts have been around since the 90s but did not truly start gathering momentum until Apple, Adobe, Microsoft, Google, and some key type foundries collaborated to create OpenType Font Variations (aka variable fonts) for the OpenType specification (mid-2016).<\/p>\n\n\n\n<p>Fast forward to 2022, and many independent designers and large foundries have created hundreds of variable fonts. <\/p>\n\n\n\n<p>A single variable font can serve a variety of design axes, but in a single file. Whereas, a static font will serve a specific weight or style for each design variation.<\/p>\n\n\n\n<div class=\"wp-block-group has-polar-background-color has-background is-layout-flow wp-block-group-is-layout-flow\" style=\"padding-top:1.5rem;padding-bottom:1rem\">\n<p class=\"has-small-font-size\"><strong>Static<\/strong> font example with multiple weights.<\/p>\n\n\n<pre class=\"wp-block-code\" style=\"margin-top:10px;margin-bottom:0px\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-code-table shcb-line-numbers\"><span class='shcb-loc'><span><span class=\"hljs-comment\">\/* Open Sans - Regular &#91;static] *\/<\/span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-keyword\">@font-face<\/span> {\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-display<\/span>: swap;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-family<\/span>: <span class=\"hljs-string\">'Open Sans'<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-style<\/span>: normal;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-weight<\/span>: <span class=\"hljs-number\">400<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">src<\/span>: <span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'OpenSans-Regular-webfont.woff2'<\/span>) <span class=\"hljs-built_in\">format<\/span>(<span class=\"hljs-string\">'woff2'<\/span>);\n<\/span><\/span><span class='shcb-loc'><span>}\n<\/span><\/span><span class='shcb-loc'><span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-comment\">\/* Open Sans - Bold &#91;static] *\/<\/span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-keyword\">@font-face<\/span> {\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-display<\/span>: swap;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-family<\/span>: <span class=\"hljs-string\">'Open Sans'<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-style<\/span>: normal;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-weight<\/span>: <span class=\"hljs-number\">700<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">src<\/span>: <span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'OpenSans-Bold-webfont.woff2'<\/span>) <span class=\"hljs-built_in\">format<\/span>(<span class=\"hljs-string\">'woff2'<\/span>);\n<\/span><\/span><span class='shcb-loc'><span>}\n<\/span><\/span><span class='shcb-loc'><span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-comment\">\/* Open Sans - Bold Italic &#91;static] *\/<\/span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-keyword\">@font-face<\/span> {\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-display<\/span>: swap;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-family<\/span>: <span class=\"hljs-string\">'Open Sans'<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-style<\/span>: italic;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-weight<\/span>: <span class=\"hljs-number\">700<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">src<\/span>: <span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'OpenSans-BoldItalic-webfont.woff2'<\/span>) <span class=\"hljs-built_in\">format<\/span>(<span class=\"hljs-string\">'woff2'<\/span>);\n<\/span><\/span><span class='shcb-loc'><span>}\n<\/span><\/span><span class='shcb-loc'><span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-comment\">\/* Open Sans - more font weights ... *\/<\/span>\n<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre><\/div>\n\n\n\n<div class=\"wp-block-group has-polar-background-color has-background is-layout-flow wp-block-group-is-layout-flow\" style=\"margin-top:0px;margin-bottom:0px;padding-top:1rem;padding-bottom:1rem\">\n<p class=\"has-small-font-size\"><strong>Variable<\/strong> font example with multiple weights.<\/p>\n\n\n<pre class=\"wp-block-code\" style=\"margin-top:10px;margin-bottom:0px\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-code-table shcb-line-numbers\"><span class='shcb-loc'><span><span class=\"hljs-comment\">\/* Open Sans &#91;variable] *\/<\/span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-keyword\">@font-face<\/span> {\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-display<\/span>: swap;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-family<\/span>: <span class=\"hljs-string\">'Open Sans'<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-stretch<\/span>: <span class=\"hljs-number\">100%<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">font-weight<\/span>: <span class=\"hljs-number\">300<\/span> <span class=\"hljs-number\">600<\/span>;\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-attribute\">src<\/span>: <span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'fonts\/OpenSans-VariableFont_wdth,wght.woff2'<\/span>) <span class=\"hljs-built_in\">format<\/span>(<span class=\"hljs-string\">'woff2 supports variations'<\/span>),\n<\/span><\/span><span class='shcb-loc'><span>\t\t\t<span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'fonts\/OpenSans-VariableFont_wdth,wght.woff2'<\/span>) <span class=\"hljs-built_in\">format<\/span>(<span class=\"hljs-string\">'woff2-variations'<\/span>);\n<\/span><\/span><span class='shcb-loc'><span>}\n<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre><\/div>\n\n\n\n<p>It is easy to look at those code examples and think: I should definitely use variable fonts, because it is a single file and the syntax is more concise. However, there is a lot more to consider. So, sit back and grab a cup of coffee \u2615\ufe0f (or your favorite drink). Let&#8217;s dive into some of the nuances.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Variable font axes<\/h2>\n\n\n\n<p>Say what? Variable fonts allow for multiple axes, including <code>ital<\/code>, <code>wdth<\/code>, and <code>wght<\/code>. This is arguably the best feature of variable fonts. Historically, different font weights and styles required unique, separate font files. However, variable fonts introduce axes for the user to manipulate slant, weight and width, and all within a single font file.<\/p>\n\n\n\n<p>Since there is only one file to include on your site, then ideally there is a performance benefit. However, it greatly depends on which variable font you use, which features you choose to use, what format and subset you use, and how you package it all up for serving to your users.<\/p>\n\n\n\n<p>Let&#8217;s focus on an example and compare how we might use a traditional static font versus a variable font.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Static vs. Variable font comparison<\/h2>\n\n\n\n<p>Let&#8217;s take a common font like <a href=\"https:\/\/fonts.google.com\/specimen\/Open+Sans\" target=\"_blank\" rel=\"noreferrer noopener\">Open Sans<\/a> and compare how we might use it in a real-world theme with static and variable font differences. First, we&#8217;ll use these common rules for comparing the different formats:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Only use the weights and styles that we need.<\/li><li>Download the fonts and <a href=\"https:\/\/wpengine.com\/builders\/self-hosting-fonts\/\">host them locally<\/a>.<\/li><li>Make sure they&#8217;re converted and served as <code>.woff2<\/code> format. This is the most performant format and has rather <a href=\"https:\/\/caniuse.com\/?search=woff2\" target=\"_blank\" rel=\"noreferrer noopener\">good coverage from most browsers<\/a> these days.<ul><li>There are a few online services that allow you to <a href=\"https:\/\/cloudconvert.com\/ttf-to-woff2\">upload and convert fonts<\/a> to <code>.woff2<\/code>.  I&#8217;ll be using <a href=\"https:\/\/github.com\/google\/woff2\" target=\"_blank\" rel=\"noreferrer noopener\">Google&#8217;s <code>.woff2<\/code> CLI compression tool<\/a> for now.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>The first step is always being mindful of choosing and <em>using only the font weights and styles we need<\/em>. This is key to optimizing our font&#8217;s overall size(s). We&#8217;ll imagine that our theme design requires only Open Sans Light for our large titles, Open Sans Regular for our main body copy, and Open Sans SemiBold for our other headings. This seems like a rather conservative and practical stack.<\/p>\n\n\n\n<div class=\"wp-block-group has-polar-background-color has-background is-layout-flow wp-container-core-group-is-layout-464b1fb5 wp-block-group-is-layout-flow\" style=\"padding-top:1.25rem;padding-bottom:1.25rem\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-e088cbc5 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-outermost-icon-block items-justified-undefined\"><div class=\"icon-container has-icon-color\" style=\"color:#7e5cef;width:38px\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M10 11c-1.588-.479-4-.91-4-.91s2-.241 4-.454c1.8-.191 3.365-.502 4-3.181C14.635 3.775 15 1 15 1s.365 2.775 1 5.455c.635 2.679 2 2.969 4 3.181 2 .213 4 .455 4 .455s-2.412.43-4 .909c-1.588.479-3 1-4 4.546-.746 2.643-.893 4.948-1 5.454-.107-.506-.167-2.5-1-5.454C13 12 11.588 11.479 10 11zM7.333 3.5C6.803 3.333 6 3.182 6 3.182s.667-.085 1.333-.16c.6-.066 1.122-.175 1.334-1.113C8.878.971 9 0 9 0s.122.971.333 1.91c.212.937.667 1.038 1.334 1.113.666.074 1.333.159 1.333.159s-.804.15-1.333.318c-.53.167-1 .35-1.334 1.59C9.085 6.017 9.036 6.824 9 7c-.036-.177-.056-.875-.333-1.91-.334-1.24-.804-1.423-1.334-1.59zM2.444 18C1.474 17.713 0 17.454 0 17.454s1.222-.145 2.444-.272c1.1-.115 2.057-.302 2.445-1.91C5.277 13.666 5.5 12 5.5 12s.223 1.665.611 3.273c.388 1.607 1.222 1.781 2.445 1.909 1.222.127 2.444.273 2.444.273s-1.474.258-2.444.545c-.971.287-1.834.6-2.445 2.727-.456 1.586-.546 2.97-.611 3.273-.065-.304-.102-1.5-.611-3.273C4.278 18.6 3.415 18.287 2.444 18z\"><\/path><\/svg><\/div><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>The more you know!<\/strong><\/p>\n<\/div>\n\n\n\n<p>Did you know that Google Fonts offers a means to filter and &#8220;Show only variable fonts&#8221; when browsing? It most certainly does.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-border\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"500\" src=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/google-Fonts-filter-by-variable.webp\" alt=\"\" class=\"wp-image-4557\" srcset=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/google-Fonts-filter-by-variable.webp 900w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/google-Fonts-filter-by-variable-300x167.webp 300w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/google-Fonts-filter-by-variable-768x427.webp 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Open Sans <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-heliotrope-color\"><em>Static<\/em><\/mark><\/strong> Font example<\/h3>\n\n\n\n<p>Since our static font has separate files for weight and italic, then we&#8217;ll want to include the following variations:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Open Sans Light<\/li><li>Open Sans Regular<\/li><li>Open Sans Regular Italic<\/li><li>Open Sans SemiBold<\/li><li>Open Sans SemiBold Italic<\/li><\/ul>\n\n\n\n<p>Note: we will <strong>not<\/strong> load in Open Sans Light Italic and will tell our editors to refrain from using italics in our large headings. They will likely forget about this restriction and still use italics once in a while, which is fine because most browsers will still render the font as a pseudo-italic or the closest browser interpretation.<\/p>\n\n\n\n<p>After we download the necessary fonts and convert them to <code>.woff2<\/code> format, we end up with the five font files totaling <strong>310 KB<\/strong>.<\/p>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-border\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"105\" src=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-static-total-size.webp\" alt=\"\" class=\"wp-image-4558\" srcset=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-static-total-size.webp 700w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-static-total-size-300x45.webp 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Open Sans static font folder size: 310 KB<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Open Sans <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-heliotrope-color\"><em>Variable<\/em><\/mark> Font example<\/h3>\n\n\n\n<p>Now, let&#8217;s download our Open Sans variable font equivalent. Our single variable font file is <strong>280 KB (30 KB less than the static version)<\/strong>.<\/p>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-border\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"77\" src=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-variable-total-size.webp\" alt=\"\" class=\"wp-image-4559\" srcset=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-variable-total-size.webp 700w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/open-Sans-variable-total-size-300x33.webp 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Open Sans variable font folder size: 280 KB<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Exploring the nuances<\/h2>\n\n\n\n<p>Your conclusion of the above results may help you see the compelling reasons to consider using variable fonts in your next WordPress theme. However, there are some nuances and further details to consider.<\/p>\n\n\n\n<p><strong>How many weights and styles will you be using on each page? <\/strong><\/p>\n\n\n\n<p>We used all five styles and weights on the final page in our example. However, suppose you only need a single weight and corresponding style, e.g., Open Sans Regular and Open Sans Regular Italic. In that case, you\u2019ll want to load the separate, static file versions of Open Sans Regular and Open Sans Regular Italic&nbsp;<em>only<\/em>. This would accrue a mere 123 KB if you used both on the page. Whereas with the variable file, it is still 280 KB loaded.<\/p>\n\n\n\n<p><strong>Do I need true italic for my variable font?<\/strong><\/p>\n\n\n\n<p>Different variable fonts handle italic differently. I&#8217;ve found that most fonts downloaded from Google Fonts include a separate italics file for variable fonts. So, there are usually two files to convert and include. However, I typically use the non-italic and allow the browser to render its interpretation of pseudo-italic. So, it is a matter of preference.<\/p>\n\n\n\n<p>You can see in the screenshot below a side-by-side comparison of the rendered output for the corresponding tests with the fonts loaded in Chrome Developer Tools beneath each test. The pseudo-italics (on the right) are close to the true italic output (on the left).<\/p>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image alignwide size-large is-style-border\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"855\" src=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans-1024x855.webp\" alt=\"\" class=\"wp-image-4560\" srcset=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans-1024x855.webp 1024w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans-300x251.webp 300w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans-768x641.webp 768w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans-1536x1283.webp 1536w, https:\/\/wpengine.com\/builders\/wp-content\/uploads\/side-by-side-open-sans.webp 1588w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Side-by-side comparison of Open Sans static and variable rendered output. Right-hand side has pseudo italics applied.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Next Steps<\/strong><\/h2>\n\n\n\n<p>As you can see, when to use variable or static fonts is not so cut and dry. It is important to experiment and consider what type of weights and styles you want to serve your users, and keep the performance impact in mind.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"178\" src=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/variable-fonts-hidden-features.gif\" alt=\"\" class=\"wp-image-4561\"\/><\/figure>\n\n\n\n<p>Curious whether to use a variable or static font for a project? Send me a DM on Twitter <a href=\"https:\/\/twitter.com\/dcook\" target=\"_blank\" rel=\"noreferrer noopener\">@dcook<\/a> and let&#8217;s chat about it!<\/p>\n\n\n\n<div class=\"wp-block-group has-polar-background-color has-background is-layout-flow wp-block-group-is-layout-flow\" style=\"padding-top:1.25rem;padding-bottom:1.25rem\">\n<h2 class=\"wp-block-heading\">Extend your exploration<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/play.typedetail.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Font Playground<\/a><\/li><li><a href=\"https:\/\/variablefonts.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">A Variable Fonts Primer<\/a><\/li><li><a href=\"https:\/\/v-fonts.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Variable Fonts v0.2<\/a><\/li><\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s explore some font techniques that can help us offer a faster experience in our WordPress themes.<\/p>\n","protected":false},"author":11,"featured_media":4556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_EventAllDay":false,"_EventTimezone":"","_EventStartDate":"","_EventEndDate":"","_EventStartDateUTC":"","_EventEndDateUTC":"","_EventShowMap":false,"_EventShowMapLink":false,"_EventURL":"","_EventCost":"","_EventCostDescription":"","_EventCurrencySymbol":"","_EventCurrencyCode":"","_EventCurrencyPosition":"","_EventDateTimeSeparator":"","_EventTimeRangeSeparator":"","_EventOrganizerID":[],"_EventVenueID":[],"_OrganizerEmail":"","_OrganizerPhone":"","_OrganizerWebsite":"","_VenueAddress":"","_VenueCity":"","_VenueCountry":"","_VenueProvince":"","_VenueState":"","_VenueZip":"","_VenuePhone":"","_VenueURL":"","_VenueStateProvince":"","_VenueLat":"","_VenueLng":"","_VenueShowMap":false,"_VenueShowMapLink":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4533","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Font Techniques for Modern WordPress Themes - Builders<\/title>\n<meta name=\"description\" content=\"Let&#039;s explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/builders\/add-google-fonts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Font Techniques for Modern WordPress Themes - Builders\" \/>\n<meta property=\"og:description\" content=\"Let&#039;s explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/builders\/add-google-fonts\/\" \/>\n<meta property=\"og:site_name\" content=\"Builders\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-01T15:59:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-04T14:42:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/font-techniques-for-modern-wordpress-themes.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Damon Cook\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/font-techniques-for-modern-wordpress-themes.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@dcook\" \/>\n<meta name=\"twitter:site\" content=\"@wpebuilders\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Damon Cook\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/font-techniques-wordpress-themes\\\/\"},\"author\":{\"name\":\"Damon Cook\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/person\\\/9d8d20c8a321b90faceae588fcf6d30d\"},\"headline\":\"Font Techniques for Modern WordPress Themes\",\"datePublished\":\"2022-08-01T15:59:24+00:00\",\"dateModified\":\"2024-01-04T14:42:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/font-techniques-wordpress-themes\\\/\"},\"wordCount\":1085,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/modern-font-techniques.webp\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/font-techniques-wordpress-themes\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/\",\"name\":\"Font Techniques for Modern WordPress Themes - Builders\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/modern-font-techniques.webp\",\"datePublished\":\"2022-08-01T15:59:24+00:00\",\"dateModified\":\"2024-01-04T14:42:20+00:00\",\"description\":\"Let's explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/modern-font-techniques.webp\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/modern-font-techniques.webp\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/add-google-fonts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Font Techniques for Modern WordPress Themes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\",\"name\":\"Builders\",\"description\":\"Reimagining the way we build with WordPress.\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\",\"name\":\"WP Engine\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/WP-Engine-Horizontal@2x.png\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/WP-Engine-Horizontal@2x.png\",\"width\":348,\"height\":68,\"caption\":\"WP Engine\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/wpebuilders\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCh1WuL54XFb9ZI6m6goFv1g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/person\\\/9d8d20c8a321b90faceae588fcf6d30d\",\"name\":\"Damon Cook\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g\",\"caption\":\"Damon Cook\"},\"description\":\"Damon Cook is a Developer Advocate at WP Engine. Previously, he navigated the WordPress agency land for a decade. He is a purveyor and discoverer of musical frisson. He can be found in the realms of WordPress Slack, WooCommerce Slack, and Twitter.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/dcook\"],\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/author\\\/damon-cook\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Font Techniques for Modern WordPress Themes - Builders","description":"Let's explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/builders\/add-google-fonts\/","og_locale":"en_US","og_type":"article","og_title":"Font Techniques for Modern WordPress Themes - Builders","og_description":"Let's explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts","og_url":"https:\/\/wpengine.com\/builders\/add-google-fonts\/","og_site_name":"Builders","article_published_time":"2022-08-01T15:59:24+00:00","article_modified_time":"2024-01-04T14:42:20+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/font-techniques-for-modern-wordpress-themes.jpg","type":"image\/jpeg"}],"author":"Damon Cook","twitter_card":"summary_large_image","twitter_image":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/font-techniques-for-modern-wordpress-themes.jpg","twitter_creator":"@dcook","twitter_site":"@wpebuilders","twitter_misc":{"Written by":"Damon Cook","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#article","isPartOf":{"@id":"https:\/\/wpengine.com\/builders\/font-techniques-wordpress-themes\/"},"author":{"name":"Damon Cook","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/person\/9d8d20c8a321b90faceae588fcf6d30d"},"headline":"Font Techniques for Modern WordPress Themes","datePublished":"2022-08-01T15:59:24+00:00","dateModified":"2024-01-04T14:42:20+00:00","mainEntityOfPage":{"@id":"https:\/\/wpengine.com\/builders\/font-techniques-wordpress-themes\/"},"wordCount":1085,"commentCount":0,"publisher":{"@id":"https:\/\/wpengine.com\/builders\/#organization"},"image":{"@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/modern-font-techniques.webp","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wpengine.com\/builders\/add-google-fonts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wpengine.com\/builders\/font-techniques-wordpress-themes\/","url":"https:\/\/wpengine.com\/builders\/add-google-fonts\/","name":"Font Techniques for Modern WordPress Themes - Builders","isPartOf":{"@id":"https:\/\/wpengine.com\/builders\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/modern-font-techniques.webp","datePublished":"2022-08-01T15:59:24+00:00","dateModified":"2024-01-04T14:42:20+00:00","description":"Let's explore some font techniques that can help us offer a faster experience in our WordPress themes and compare variable and static fonts","breadcrumb":{"@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/builders\/add-google-fonts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#primaryimage","url":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/modern-font-techniques.webp","contentUrl":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/modern-font-techniques.webp","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/builders\/add-google-fonts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/builders\/"},{"@type":"ListItem","position":2,"name":"Font Techniques for Modern WordPress Themes"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/builders\/#website","url":"https:\/\/wpengine.com\/builders\/","name":"Builders","description":"Reimagining the way we build with WordPress.","publisher":{"@id":"https:\/\/wpengine.com\/builders\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/builders\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpengine.com\/builders\/#organization","name":"WP Engine","url":"https:\/\/wpengine.com\/builders\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/logo\/image\/","url":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/2024\/05\/WP-Engine-Horizontal@2x.png","contentUrl":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/2024\/05\/WP-Engine-Horizontal@2x.png","width":348,"height":68,"caption":"WP Engine"},"image":{"@id":"https:\/\/wpengine.com\/builders\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/wpebuilders","https:\/\/www.youtube.com\/channel\/UCh1WuL54XFb9ZI6m6goFv1g"]},{"@type":"Person","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/person\/9d8d20c8a321b90faceae588fcf6d30d","name":"Damon Cook","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18d75285d6803fab88b7f45601bb68cbac7c3956347217c06a0291e27dc65f6a?s=96&d=mm&r=g","caption":"Damon Cook"},"description":"Damon Cook is a Developer Advocate at WP Engine. Previously, he navigated the WordPress agency land for a decade. He is a purveyor and discoverer of musical frisson. He can be found in the realms of WordPress Slack, WooCommerce Slack, and Twitter.","sameAs":["https:\/\/x.com\/dcook"],"url":"https:\/\/wpengine.com\/builders\/author\/damon-cook\/"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts\/4533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/comments?post=4533"}],"version-history":[{"count":0,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts\/4533\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/media\/4556"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/media?parent=4533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/categories?post=4533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/tags?post=4533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}