<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://web.dev/</id>
  <title>Dominik Röttsches on web.dev</title>
  <updated>2026-04-15T23:21:06Z</updated>
  <author>
    <name>Dominik Röttsches</name>
  </author>
  <link href="https://web.dev/authors/drott/feed.xml" rel="self"/>
  <link href="https://web.dev/"/>
  <icon>https://web-dev.imgix.net/image/admin/xb7jK8lMyvbHQrBJzlxv.jpg?auto=format</icon>
  <logo>https://web.dev/images/shared/rss-banner.png</logo>
  <subtitle>Our latest news, updates, and stories by Dominik Röttsches.</subtitle>
  
  
  <entry>
    <title>More variable font options for the macOS `system-ui` font in Chromium 83</title>
    <link href="https://web.dev/more-variable-font-options-in-chromium-83/"/>
    <updated>2020-05-21T00:00:00Z</updated>
    <id>https://web.dev/more-variable-font-options-in-chromium-83/</id>
    <content type="html" mode="escaped">&lt;p&gt;The &lt;a href=&quot;https://drafts.csswg.org/css-fonts-4/#system-ui-def&quot; rel=&quot;noopener&quot;&gt;&#39;system-ui&#39; section&lt;/a&gt; of the CSS Fonts Module Level 4 spec defines a &lt;code&gt;system-ui&lt;/code&gt; font keyword that allows developers to use the built-in, turbo-optimized, localized, mega-high-quality, no-download-needed, default operating system font right in their sites and apps.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; system-ui&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;This typography choice is akin to saying &amp;quot;use the default system font for the current locale of this user.&amp;quot;&lt;/p&gt;
&lt;p&gt;On macOS, the &lt;code&gt;system-ui&lt;/code&gt; font is San Francisco, a font that a design team vetted, tested, and… recently upgraded! First we&#39;ll cover the &lt;a href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#new-powers&quot;&gt;new exciting variable font features in Catalina&lt;/a&gt;, then we&#39;ll cover a couple of &lt;a href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#regression&quot;&gt;bugs and how Chromium engineers resolved them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This post assumes that you&#39;re already familiar with variable fonts. If not, check out &lt;a href=&quot;https://web.dev/variable-fonts/&quot;&gt;Introduction to variable fonts on the web&lt;/a&gt; and the video below.&lt;/p&gt;
&lt;div class=&quot;youtube&quot;&gt;  &lt;lite-youtube videoid=&quot;B42rUMdcB7c&quot;&gt;  &lt;/lite-youtube&gt;&lt;/div&gt;
&lt;h3 id=&quot;browser-compatibility&quot;&gt;Browser compatibility &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#browser-compatibility&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;At the time of writing, &lt;code&gt;system-ui&lt;/code&gt; has support from Chromium (since 56), Edge (since 79), Safari (since 11), and from Firefox (since 43) but with the &lt;code&gt;-apple-system&lt;/code&gt; keyword. See &lt;a href=&quot;https://caniuse.com/#feat=variable-fonts&quot; rel=&quot;noopener&quot;&gt;Can I use variable fonts?&lt;/a&gt; for updates.&lt;/p&gt;
&lt;h2 id=&quot;new-powers&quot;&gt;New powers &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#new-powers&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The new abilities that Catalina brought to the system font are now available to web developers as of Chromium 83. The &lt;code&gt;system-ui&lt;/code&gt; font now &lt;strong&gt;has more variable settings&lt;/strong&gt;: optical sizing and 2 unique weight adjustments:&lt;/p&gt;
&lt;figure class=&quot;compare flow&quot; data-type=&quot;worse&quot; data-size=&quot;full&quot;&gt;&lt;p class=&quot;compare__label&quot;&gt;Mojave&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; system-ui&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 700&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;wght&#39;&lt;/span&gt; 750&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/figure&gt;
&lt;figure class=&quot;compare flow&quot; data-type=&quot;better&quot; data-size=&quot;full&quot;&gt;&lt;p class=&quot;compare__label&quot;&gt;Catalina&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; system-ui&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 700&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;wght&#39;&lt;/span&gt; 750&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;opsz&#39;&lt;/span&gt; 20&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;GRAD&#39;&lt;/span&gt; 400&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;YAXS&#39;&lt;/span&gt; 400&lt;/mark&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/figure&gt;
&lt;aside class=&quot;aside flow bg-tertiary-box-bg color-tertiary-box-text&quot;&gt;&lt;p class=&quot;cluster &quot;&gt;&lt;span class=&quot;aside__icon box-block &quot;&gt;&lt;svg width=&quot;24&quot; height=&quot;24&quot; viewBox=&quot;0 0 24 24&quot; role=&quot;img&quot; aria-label=&quot;Lightbulb&quot; fill=&quot;currentColor&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;   &lt;path d=&quot;M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6A4.997 4.997 0 017 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z&quot;&gt;&lt;/path&gt; &lt;/svg&gt;&lt;/span&gt;&lt;strong&gt;Gotchas&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot; flow&quot;&gt; These variant features are only available for macOS Catalina users. &lt;/div&gt;&lt;/aside&gt;
&lt;p&gt;On Mojave, &lt;code&gt;system-ui&lt;/code&gt; is a variable font with only &lt;code&gt;wght&lt;/code&gt; settings. While &lt;code&gt;system-ui&lt;/code&gt; on Catalina is a variable font with &lt;code&gt;wght&lt;/code&gt;, &lt;code&gt;opsz&lt;/code&gt;, &lt;code&gt;GRAD&lt;/code&gt;, and &lt;code&gt;YAXS&lt;/code&gt; settings.&lt;/p&gt;
&lt;p&gt;Looks like some neat progressive enhancement design opportunities to me! Really dig into the subtleties of the system font if you want.&lt;/p&gt;
&lt;h3 id=&quot;wght&quot;&gt;&lt;code&gt;wght&lt;/code&gt;  &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#wght&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Accepts a font weight between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;900&lt;/code&gt; and is applied equally to all characters.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* 0-900 */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;wght&#39;&lt;/span&gt; 750&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_wght.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_wght.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;opsz&quot;&gt;&lt;code&gt;opsz&lt;/code&gt; &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#opsz&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Optical sizing is similar to kerning or letter-spacing, but the spacing is done by a human eye instead of math. A value of &lt;code&gt;19&lt;/code&gt; or below is intended for text and body copy spacing, while &lt;code&gt;20&lt;/code&gt; or above is for spacing display headers and titles.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* 19 or 20 */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;opsz&#39;&lt;/span&gt; 20&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_opsz_v2.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_opsz_v2.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;grad&quot;&gt;&lt;code&gt;GRAD&lt;/code&gt; &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#grad&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Similar to weight, but without touching horizontal spacing. It accepts values between &lt;code&gt;400&lt;/code&gt; and &lt;code&gt;1000&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* 400-1000 */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;GRAD&#39;&lt;/span&gt; 500&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_grad_v2.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_grad_v2.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;yaxs&quot;&gt;&lt;code&gt;YAXS&lt;/code&gt; &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#yaxs&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Stretches the glyph vertically. It accepts values between &lt;code&gt;400&lt;/code&gt; and &lt;code&gt;1000&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* 400-1000 */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;YAXS&#39;&lt;/span&gt; 500&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_yaxs_v2.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_yaxs_v2.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;combining-the-options&quot;&gt;Combining the options &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#combining-the-options&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;With a few lines of CSS, we can tweak the font settings into a bold of our choice or try out other interesting combinations:&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 700&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; bold&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;wght&#39;&lt;/span&gt; 750&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;YAXS&#39;&lt;/span&gt; 600&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;GRAD&#39;&lt;/span&gt; 500&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;opsz&#39;&lt;/span&gt; 20&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_combined_v2.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_combined_v2.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;And just like that, Chromium users on macOS see your upgraded, custom 750 weight with some fun other tweaks 👍&lt;/p&gt;
&lt;h2 id=&quot;playground&quot;&gt;Playground &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#playground&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Click &lt;strong&gt;Remix to Edit&lt;/strong&gt; in the Glitch below to get an editable copy of the Glitch, and then edit the new &lt;code&gt;font-variation-settings&lt;/code&gt; options to see how it affects your font. Remember that this Glitch will only work if you&#39;re using a macOS Catalina device.&lt;/p&gt;
&lt;div class=&quot;glitch-embed-wrap&quot; style=&quot;height: 480px; width: 100%;&quot;&gt;
  &lt;iframe allow=&quot;camera; clipboard-read; clipboard-write; encrypted-media; geolocation; microphone; midi&quot; loading=&quot;lazy&quot; src=&quot;https://glitch.com/embed/#!/embed/macos-system-ui?attributionHidden=true&amp;sidebarCollapsed=true&amp;path=style.css&amp;previewSize=50&quot; style=&quot;height: 100%; width: 100%; border: 0;&quot; title=&quot;macos-system-ui on Glitch&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;p&gt;macOS 10.15 added new features to its system font, and in macOS 10.15 a tricky &lt;code&gt;system-ui&lt;/code&gt; bug was logged in the Chromium bug tracker. I wonder if they are related!?&lt;/p&gt;
&lt;aside class=&quot;aside flow bg-state-info-bg color-state-info-text&quot;&gt;&lt;div class=&quot; flow&quot;&gt;The image for this article was made with CSS and &lt;code&gt;system-ui&lt;/code&gt;. Here&#39;s the &lt;a href=&quot;https://codepen.io/argyleink/pen/eYpbwWd&quot;&gt;codepen&lt;/a&gt;.&lt;/div&gt;&lt;/aside&gt;
&lt;h2 id=&quot;regression&quot;&gt;Appendix: The &lt;code&gt;system-ui&lt;/code&gt; regression &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#regression&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;aside class=&quot;aside flow bg-state-info-bg color-state-info-text&quot;&gt;&lt;div class=&quot; flow&quot;&gt; The rest of this blog post explains how &lt;code&gt;system-ui&lt;/code&gt; broke in Chromium 80 and how the Chromium engineers fixed it. If this isn&#39;t interesting or relevant for you, you can stop reading now. &lt;/div&gt;&lt;/aside&gt;
&lt;p&gt;This story starts with a different bug: &lt;a href=&quot;https://crbug.com/1005969&quot; rel=&quot;noopener&quot;&gt;#1005969&lt;/a&gt;. This was reported against macOS 10.15 because the &lt;code&gt;system-ui&lt;/code&gt; font spacing looked narrow and crammed.&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;A comparison of two paragraphs from a Facebook group page. On the left is Chrome and the right is Safari, and Chrome is subtle but slightly tighter in spacing&quot; decoding=&quot;async&quot; height=&quot;417&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/f0xi5DBj1M6v72VcKNUx.jpg?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Chrome on left (tighter tracking), Safari on right (better optical spacing)&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;background&quot;&gt;Background &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#background&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Did you ever notice on macOS 10.14 how your paragraphs or headers &amp;quot;snapped&amp;quot; to a different looking font when the size went up or down?&lt;/p&gt;
&lt;figure&gt;
  &lt;video playsinline=&quot;&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot;&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_20to19.webm&quot; type=&quot;video/webm&quot; /&gt;
    &lt;source src=&quot;https://storage.googleapis.com/web-dev-assets/macos-system-ui/system-ui_20to19.mp4&quot; /&gt;
  &lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;On Mojave (macOS 10.14), the &lt;code&gt;system-ui&lt;/code&gt; font switched between two fonts depending on the target font size. When text was under &lt;code&gt;20px&lt;/code&gt;, macOS used &amp;quot;San Francisco Text&amp;quot;. When text was &lt;code&gt;20px&lt;/code&gt; or over, macOS used &amp;quot;San Francisco Display&amp;quot;. Optical sizing was built statically into two separate fonts.&lt;/p&gt;
&lt;p&gt;Catalina (macOS 10.15) shipped a new united variable font for San Francisco. No more managing &amp;quot;Text&amp;quot; and &amp;quot;Display&amp;quot;. It also gained the new variation setting &lt;a href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#opsz&quot;&gt;&lt;code&gt;opsz&lt;/code&gt;&lt;/a&gt; described earlier.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-variation-settings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;opsz&#39;&lt;/span&gt; 20&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Unfortunately, the default &lt;code&gt;opsz&lt;/code&gt; value in the new Catalina font is &lt;code&gt;20&lt;/code&gt;, and Chromium engineers were not prepared to apply &lt;code&gt;opsz&lt;/code&gt; to the system font. This led to smaller sizes displaying too narrow.&lt;/p&gt;
&lt;p&gt;To fix that, Chromium needed to apply &lt;code&gt;opsz&lt;/code&gt; correctly to the system font. This led to &lt;a href=&quot;https://crbug.com/1005969&quot; rel=&quot;noopener&quot;&gt;Issue #1005969&lt;/a&gt; getting fixed. Victory! Or was it…?&lt;/p&gt;
&lt;h3 id=&quot;not-done-yet&quot;&gt;Not done yet &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#not-done-yet&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This is where it got tricky: Chromium applied &lt;code&gt;opsz&lt;/code&gt; but something did not look right still. System fonts on Mac have an additional font table called &lt;a href=&quot;https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6trak.html&quot; rel=&quot;noopener&quot;&gt;&lt;code&gt;trak&lt;/code&gt;&lt;/a&gt;, which tweaks horizontal spacing. While working on the fix, Chromium engineers noticed that on macOS, when retrieving horizontal metrics from a &lt;code&gt;CTFontRef&lt;/code&gt; object, the &lt;code&gt;trak&lt;/code&gt; metrics were already getting factored into the metrics results. Chromium&#39;s shaping library &lt;a href=&quot;https://github.com/harfbuzz/harfbuzz&quot; rel=&quot;noopener&quot;&gt;&lt;code&gt;HarfBuzz&lt;/code&gt;&lt;/a&gt; needs metrics where the &lt;code&gt;trak&lt;/code&gt; values are not yet factored in.&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;A display of system-ui and all of it&amp;#x27;s font weight and variations in a list. Half of them have no weight differences applied.&quot; decoding=&quot;async&quot; height=&quot;481&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/rq7Vpi6ZfUzFNKEOVACk.jpg?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Left: Bold weights applied to font sizes 19 and below. Right: Font sizes 20 and up lose bold styling&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Internally, &lt;a href=&quot;https://skia.org/&quot; rel=&quot;noopener&quot;&gt;Skia&lt;/a&gt; (the graphics library, not the typeface of the same name) uses both the &lt;code&gt;CGFontRef&lt;/code&gt; class from &lt;a href=&quot;https://developer.apple.com/documentation/coregraphics&quot; rel=&quot;noopener&quot;&gt;&lt;code&gt;CoreGraphics&lt;/code&gt;&lt;/a&gt; and the &lt;code&gt;CTFontRef&lt;/code&gt; class from &lt;a href=&quot;https://developer.apple.com/documentation/coretext&quot; rel=&quot;noopener&quot;&gt;&lt;code&gt;CoreText&lt;/code&gt;&lt;/a&gt;. Due to required internal conversions between those objects (used for keeping backwards compatibility and accessing needed APIs on both classes), Skia would lose weight information in certain circumstances and bold fonts would stop working. This was tracked in &lt;a href=&quot;https://crbug.com/1057654&quot; rel=&quot;noopener&quot;&gt;Issue #1057654&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Skia still needs to support macOS 10.11 because Chromium still supports it. On 10.11 the &amp;quot;San Francisco Text&amp;quot; and &amp;quot;San Francisco Display&amp;quot; fonts weren&#39;t even variable fonts. Rather, each was a family of separate fonts for every weight available. At some point their glyph IDs became out of sync with each other. So if Skia did text shaping (converting text into glyphs that can be drawn) with &amp;quot;San Francisco Text&amp;quot;, it would be gibberish if drawn with &amp;quot;San Francisco Display&amp;quot;, and vice versa. And even if Skia just asked for a different size macOS might switch to the other. It should be possible to always use one of the fonts and just scale it (using a matrix to scale it up instead of asking for a larger size) but &lt;code&gt;CoreText&lt;/code&gt; has an issue where it will not scale sbix (color emoji) glyphs up (only down). It&#39;s a bit more complex than that. &lt;code&gt;CoreText&lt;/code&gt; actually seems to cap the vertical extent after matrix application, which seems to be related to it not being able to draw emoji at 45 degree angles. In any event, if you want your emoji to be shown big, you need to make a copy of the font to get a big version.&lt;/p&gt;
&lt;p&gt;So in order to create copies of &lt;code&gt;CTFont&lt;/code&gt; objects at different sizes internally while ensuring that the same underlying font data is used, Chromium pulled the &lt;code&gt;CGFont&lt;/code&gt; off the &lt;code&gt;CTFont&lt;/code&gt;, then made a new &lt;code&gt;CTFont&lt;/code&gt; from the &lt;code&gt;CGFont&lt;/code&gt; (&lt;code&gt;CGFont&lt;/code&gt; objects are size independent, the magic switching happens at the &lt;code&gt;CoreText&lt;/code&gt; level). This worked fine until 10.154. In 10.15 this round trip ended up losing too much information, resulting in the weight issue. &lt;a href=&quot;https://github.com/flutter/flutter/issues/49492&quot; rel=&quot;noopener&quot;&gt;Flutter noticed the weight issue&lt;/a&gt; and an alternate fix for resizing was made to create the new &lt;code&gt;CTFont&lt;/code&gt; directly from the original &lt;code&gt;CTFont&lt;/code&gt; while controlling the optical size directly using an old but undocumented attribute in &lt;code&gt;CoreText&lt;/code&gt;. This keeps things working on 10.11 and fixes other issues (like explicitly setting the optical size to the default value).&lt;/p&gt;
&lt;p&gt;However, this preserves more of the &lt;code&gt;CoreText&lt;/code&gt; &#39;magic&#39; in the font. One of these seems to be that it still tweaks the glyph advances in some way other than just the &lt;code&gt;trak&lt;/code&gt; table (the application of which Chromium was already trying to suppress through yet another undocumented attribute).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CGFont&lt;/code&gt; doesn&#39;t do any of this &#39;magic&#39; so maybe Chromium could get the &lt;code&gt;CGFont&lt;/code&gt; off the &lt;code&gt;CTFont&lt;/code&gt; and just use it to get advances? Unfortunately this wouldn&#39;t work because &lt;code&gt;CoreText&lt;/code&gt; is known to muck with fonts in other ways as well. For example, it makes small emoji slightly bigger than you actually requested (boosting their size a bit). &lt;code&gt;CGFont&lt;/code&gt; doesn&#39;t know about this, so you&#39;d end up with your sbix-based emoji too close to each other since you&#39;d be measuring at one size but &lt;code&gt;CoreText&lt;/code&gt; would draw them bigger by some amount. Chromium does want the &lt;code&gt;CTFont&lt;/code&gt; advances, but it wants them without tracking, and preferably without any other mucking about.&lt;/p&gt;
&lt;p&gt;Since the fix for the spacing issue required a set of interconnected Blink and Skia fixes, the Chromium engineers could not &amp;quot;just revert&amp;quot; to fix the problem. The Chromium engineers also tried using a different build flag for changing a font-related codepath in Skia, which fixed the bold fonts problem, but regressed the spacing problem.&lt;/p&gt;
&lt;h2 id=&quot;the-fix&quot;&gt;The fix &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/more-variable-font-options-in-chromium-83/#the-fix&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the end, of course Chromium wanted to fix both things. Chromium now resorts to using HarfBuzz built-in font OpenType font metrics functions for retrieving horizontal metrics directly from the binary data in the system font&#39;s font tables. Using this, Chromium is sidestepping &lt;code&gt;CoreText&lt;/code&gt; and Skia when the font has a &lt;code&gt;trak&lt;/code&gt; table (except when it&#39;s the emoji font).&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;A display of system-ui and all of it&amp;#x27;s font weight and variations in a list. The half previously not working looks great now.&quot; decoding=&quot;async&quot; height=&quot;481&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/9KOCF5Gh0tEWETkmDEVo.jpg?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;In the meantime there&#39;s still &lt;a href=&quot;https://bugs.chromium.org/p/skia/issues/detail?id=10123&quot; rel=&quot;noopener&quot;&gt;Skia Issue #10123&lt;/a&gt; to track fixing this fully in Skia, and to go back to using Skia to retrieve the system font metrics from there, instead of the current fix that goes through &lt;code&gt;HarfBuzz&lt;/code&gt;.&lt;/p&gt;
</content>
    <author>
      <name>Adam Argyle</name>
    </author><author>
      <name>Dominik Röttsches</name>
    </author>
  </entry>
</feed>
