Sunday, 15 January 2012

SVG font glyphs: ever seen contained path's? -



SVG font glyphs: ever seen contained path's? -

i have source of svg files created programme potrace, has created separate each component of multi-segment character. if simple-mindedly create glyph definitions using these same <path>s character not display. if jam path instructions "d=" attribute of <glyph> character displays.

the svg spec says <glyph> elements containers , explicitly says can contain <path> elements. doesn't work (tested in chrome, opera, safari).

here's smallest illustration cutting downwards to:

<html> <head> <meta charset="utf-8" /> <title>svg font test sample04</title> <style type="text/css"> @font-face { font-family: 'sample04'; src: url('sample04.svg#sample04') format('svg'); } .sample04 { font-family: "sample04", verdana, helvetica; } </style> </head> <body class="sample04"> xe014 | &#xe014; | &#xe015; | </body> </html>

sample04.svg

<?xml version="1.0" encoding="utf-8" ?> <svg version="1.1" xmlns = 'http://www.w3.org/2000/svg'> <defs> <font id="sample04" horiz-adv-x="800"> <font-face font-family="sample04" /> <glyph unicode="&#xe014;" horiz-adv-x="800" d="m0,0h200v200h-200z m400,0h200v200h-200z"/> <glyph unicode="&#xe015;" horiz-adv-x="800"> <path d="m0,0h200v200h-200z"/> <path d="m400,0h200v200h-200z"/> </glyph> </font> </defs> </svg>

note 2 glyphs have same information, first contained exclusively within <glyph> d= attribute, sec having info separated 2 <path> elements. have tried single <path> element no improve results.

so case specs sparkly , browsers not it?

note: reason care much have 5000 of these svg files embed font, , didn't want heavily xml transformations convert sources...

fonts svg path glyph

No comments:

Post a Comment