Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google Fonts with SVG <object>

Tags:

I'm embedding SVGs in my page with the <object> tag, and they're supposed to utilize Google Fonts (e.g. Roboto). However, the SVGs aren't picking these fonts up and instead default to system fonts.

What am I doing wrong? Does every SVG require that the font itself be embedded in <style>?

Example code:

<head>     <link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'> </head>  <body>     <object width="250" height="200" type="image/svg+xml" data="img/popup_image.svg"></object> </body> 

SVG snippet:

<text font-size="14" fill="#333" font-family="Roboto">Words go here</text>