Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a SVG path notation for text

I have a need to generate SVG path notation for a given number (between 1 and 100).

I need to develop a JavaScript function that will take in a number and return a string that represents the SVG path notation.

Anyone know how to do this?

More context on what I'm working on:

I'm trying to generate a custom symbol to overlay on a polyline, using Google Maps API. You'll notice in the example:

  var symbolTwo = {
    path: 'M -1,0 A 1,1 0 0 0 -3,0 1,1 0 0 0 -1,0M 1,0 A 1,1 0 0 0 3,0 1,1 0 0 0 1,0M -3,3 Q 0,5 3,3',
    strokeColor: '#00F',
    rotation: 45
  };

There is a path property, which represents the SVG path notation for the symbol. This needs to follow the SVG path notation standard.

I want to draw numbers on the polylines, so I need a function that can convert a number to a SVG path notation, which I will then set as the symbol on the line.

like image 640
Paul Fryer Avatar asked Nov 02 '22 20:11

Paul Fryer


1 Answers

There is no easy way to do it. This answer may be what you want:

How can I create numbered map markers in Google Maps V3?

Basically use Google's Chart API:

http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=7|FF0000|000000

like image 55
Leon Avatar answered Nov 09 '22 10:11

Leon