I have the following SVG image:
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="-598.513 -318.988 1000 1000" width="1000" height="1000" xmlns="http://www.w3.org/2000/svg">
<defs>
<style>@import url(https://fonts.googleapis.com/css2?family=Hachi+Maru+Pop%3Aital%2Cwght%400%2C400);</style>
</defs>
<g transform="matrix(1, 0, 0, 1, -348.513, 14.569339)">
<rect style="stroke-width: 15px; fill: rgb(255, 255, 255); stroke: rgb(43, 43, 43);" width="800" height="800" rx="70" ry="70" y="-150" x="-150"/>
</g>
<text style="fill: rgb(80, 96, 255); font-family: "Hachi Maru Pop"; font-size: 692.4px; font-weight: 700; white-space: pre;" x="-381.352" y="481.913">D</text>
</svg>
It does contain @import
which imports font (Hachi Maru Pop) from Google Fonts. And it's working as expected when opening in a normal browser window:
But when using it as a browser favicon, the font breaks and loads a fallback font (which I guess is Arial):
I guess this happens because the browser loads the favicon before the font loads. Am I missing something fundamental here? How can I solve this if possible?