Since I couldn't get my TTF file to convert to an SVG file I decided to try transcoding an SVG file exported by Adobe Illustrator.  I got one of our Mac guys to export an SVG from Illustrator (using the font I want to embed) - and what it seems to do is encode the fonts used in the SVG file using base64, then includes this in a <style> tag in the SVG file.  Here is a little snip:
 
----------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"   "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
<svg width="200" height="80">
        <style type="text/css">
<![CDATA[
@font-face{font-family:'TechnoRegular';src:url("data:;base64,\
T1RUTwACACAAAQAAQ0ZGIPghb0EAAAAsAAAhnGNtYXABmwIZAAAhyAAAAGwBAAQCAAEBAQ5UZWNo\
bm9SZWd1bGFyAAEBATb4GwH4GAT+lP2eHAlqHAinBR6gAEiCgSX/i4seoABIgoEl/4uLDAf3HA/3\
....
gK8froCueaxwrnCod6J+CH6ioIWeG6ykmKSbH5ukk7C6Gg76kBT6oRUAAAABAAAAAwAAAAwABABg\
3//e/93/3P/Z/9P/0AABAAAAAAAAAAAAAAAAAAAAAAAAAAA=")}
]]>
        </style>
        <text transform="matrix(1 0 0 1 0 50)">
                <tspan x="0" y="0" style="font-family:'TechnoRegular'; stroke:none; font-size:30;">This is a test!</tspan>
        </text>
</svg>
----------------------------
 
This works great using Adobe's SVG viewer in the web browser.  But, when I try and use Batik to transcode this SVG file I get the following error:
 
org.w3c.dom.DOMException: An error occurred in an author stylesheet:
The following text represents an invalid CSS document:
 

@font-face{font-family:'TechnoRegular';src:url("data:;base64,\
T1RUTwACACAAAQAAQ0ZGIPghb0EAAAAsAAAhnGNtYXABmwIZAAAhyAAAAGwBAAQCAAEBAQ5UZWNo\
bm9SZWd1bGFyAAEBATb4GwH4GAT+lP2eHAlqHAinBR6gAEiCgSX/i4seoABIgoEl/4uLDAf3HA/3\
....
 
Can anyone provide me with any help on this?  Has anyone had luck embedding a truetype font?  I know SOME have, I saw earlier posts to the mailing list talking about "blocky" TT fonts, so apparently some people are getting this to work.
 
Thanks!
 
- Brent

Reply via email to