From 14997fd8262738cb98e690c014c1f0d48b56b728 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Jul 18 2022 15:35:19 +0000 Subject: Improve the references to the local fonts src:url() only accepts format(), not type(). Source: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src This should improve rendering of fonts via webserver. Fixing this uncovered another issue: if src:url is correctly specified, Firefox attempts to load the fonts from that url, rather than look for the local font first. To achieve the correct lookup order, src:local() should be defined before the url. Firefox then loads from the first found location. --- diff --git a/python-sphinx_rtd_theme.spec b/python-sphinx_rtd_theme.spec index b049dcd..5210ec7 100644 --- a/python-sphinx_rtd_theme.spec +++ b/python-sphinx_rtd_theme.spec @@ -104,8 +104,11 @@ for FONT in lato-normal=lato/Lato-Regular.ttf \ do L="${FONT%=*}" R="${FONT#*=}" + # Get the font basename from the path + F="${R#*/}" + F_BASENAME="${F/.ttf}" sed \ - -e "s|src:\(url(fonts/$L\.[^)]*) format([^)]*),\?\)\+|src:url('/.sysassets/fonts/$R') type(\"truetype\")|g" \ + -e "s|src:\(url(fonts/$L\.[^)]*) format([^)]*),\?\)\+|src:local('$F_BASENAME'),url('/.sysassets/fonts/$R') format(\"truetype\")|g" \ -i theme.css done @@ -188,6 +191,7 @@ grep 'format("woff2\?")' \ %changelog * Fri Jul 01 2022 Karolina Surma - 1.0.0-7 - Relax the python-docutils version requirement to <0.19 +- Improve references to system fonts (needed by Firefox) * Mon Jun 13 2022 Python Maint - 1.0.0-6 - Rebuilt for Python 3.11