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.
This commit is contained in:
Karolina Surma 2022-07-18 16:26:15 +02:00
parent fef1a90465
commit 14997fd826

View File

@ -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 <ksurma@redhat.com> - 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 <python-maint@redhat.com> - 1.0.0-6
- Rebuilt for Python 3.11