user123
September 11, 2018, 8:27pm
1
I have tried to load a very basic svg file which contains text, and it never displays the text, is this not supported?
For example I saved the svg found here…
The SVG text element defines a graphics element consisting of text. It's possible to apply a gradient, pattern, clipping path, mask, or filter to text, just like any other SVG graphics element.
and replaced the tiger svg in the exampes (https://threejs.org/examples/?q=svg#webgl_loader_svg ) with that but it wont display. Am i missing something?
You probably are missing something, but we can’t help you if you don’t show us your code! Could you upload a minimal example to http://jsfiddle.net/ ?
Hi!
Have a look at the source code of THREE.SVGLoader()
parse: function ( text ) {
function parseNode( node, style ) {
if ( node.nodeType !== 1 ) return;
var transform = getNodeTransform( node );
var path = null;
switch ( node.nodeName ) {
case 'svg':
break;
case 'g':
style = parseStyle( node, style );
break;
case 'path':
style = parseStyle( node, style );
The loader simply doesn’t parse that text node.
If to trust this article , SVG processes the rendering of text internally:
Each glyph consists of some sort of identifier (in some cases a string, in other cases a number) along with drawing instructions for rendering that particular glyph.
In your case, may be you can combine/extend this loader with THREE.FontLoader()
and THREE.Font()
somehow, getting something like that of the text from svg:
https://threejs.org/examples/?q=text#webgl_geometry_text_shapes
1 Like
user123
September 13, 2018, 5:29pm
4
Thanks alot for the response and confirming what I thought.