I am currently utilizing an SVG design featuring a unique font in order to apply that design as a background image on an HTML page.
While everything displays correctly in Chrome and Safari, Firefox seems to be giving me some trouble:
- Firefox properly renders the SVG with the custom font when I view the SVG file itself (so far so good!);
- However, Firefox fails to render the custom font when the same SVG file is used as the background for an HTML element (!)
I have spent hours attempting to pinpoint the issue and would appreciate any fresh insights.
Here is a brief overview of what I have:
CSS:
@import url(http://fonts.googleapis.com/css?family=Indie+Flower);
body {
background: url(pattern-google.svg);
}
SVG file:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" height="200" width="200">
<style type="text/css">@import url(http://fonts.googleapis.com/css?family=Indie+Flower);</style>
<defs>
<!-- Geometry -->
<g>
<rect id="square" x="0" y="0" width="200" height="200" />
</g>
<!-- Patterns with Text -->
<pattern id="pattern" x="0" y="0" width="40" height="40" patternUnits="userSpaceOnUse" text-anchor="middle" font-size="20" font-family="Indie Flower, sans-serif" style="font-family: Indie Flower, sans-serif;">
<rect x="00" y="00" width="40" height="40" fill="transparent" />
<text x="00" y="00" fill="#777">S</text>
<text x="40" y="00" fill="#777">S</text>
<text x="20" y="20" fill="#777">S</text>
<text x="00" y="40" fill="#777">S</text>
<text x="40" y="40" fill="#777">S</text>
</pattern>
</defs>
<!-- Graphics -->
<use xlink:href="#square" transform="translate(0, 0)" fill="url(#pattern)"/>
</svg>
The specific HTML content is not crucial, but it can be found through the provided link. I opted not to create a jsfiddle as I was unable to host the SVG file there.
(Beyond this demonstration, my practical goal is to utilize a customized font for displaying phonetic symbols. (As a background image, aiding individuals in learning them.) Using SVG allows me to avoid the need to convert to bitmap each time a design change is made.)