Here is a Jsfiddle demo
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<svg width="100%" height="100%" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<path id="MyPath" d="M 100 200
C 200 100 300 0 400 100
C 500 200 600 300 700 200
C 800 100 900 100 900 100" />
</defs>
<use xlink:href="#MyPath" fill="none" stroke="red" />
<text class="material-icons">
<textPath xlink:href="#MyPath">   </textPath>
</text>
<!-- Show outline of the viewport using 'rect' element -->
<rect x="1" y="1" width="998" height="298" fill="none" stroke="black" stroke-width="2" />
</svg>

is a special character which is displayed as an "arrow".
There is a problem in the demo above: The direction of the arrow in the <textPath>
is perpendicular to the <path>
, while I need to set its direction to be the same (in parallel) as the path.
Therefore, I need to rotate 90 degree for each character in the text    
(not the whole sentence)..
I found this post about rotating characters, but it looks not ideal because it needs to "Encapsule each letter in a element with jQuery". Maybe there is a way to do this easier in SVG?
Does anyone have ideas about how to rotate each character of a word in <textPath>
node?
Just add this style="writing-mode: tb; glyph-orientation-vertical: 180;"
to text
I hope this is what you wanted :
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<svg width="100%" height="100%" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<path id="MyPath" d="M 100 200
C 200 100 300 0 400 100
C 500 200 600 300 700 200
C 800 100 900 100 900 100" />
</defs>
<use xlink:href="#MyPath" fill="none" stroke="red" />
<text class="material-icons" style="writing-mode: tb; glyph-orientation-vertical: 180;">
<textPath xlink:href="#MyPath">   </textPath>
</text>
<!-- Show outline of the viewport using 'rect' element -->
<rect x="1" y="1" width="998" height="298" fill="none" stroke="black" stroke-width="2" />
</svg>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With