Saturday 15 February 2014

javascript - How to draw letters with drawImage (to avoid slow strokeText/fillText)? -


I found this jsperf, which clearly shows how fast the picture is compared to fillText:

But how to achieve exactly that if you want to make your text dynamic? It seems that you need an image of all the letters and numbers that you need and then partly to draw them on the basis of the given string.

Does anyone really work, I've read that when you probably rarely do the lessons live your app makes it very fast ...

There is some image to good Javacript, but the best I have tried is this plugin for Illustrator.

For example it will generate code for J:

  lineStyle = "rgb (0,0,0)"; Linewidth = 1; StartPath (); MoveTo (223,179); BezierCurveTo (292,187,361,185,430,192); BezierCurveTo (474,196,522,203,566,196); BezierCurveTo (587,192,606,182,627,179); BezierCurveTo (627,198,611,220,606,238); BezierCurveTo (595,284,590,330,577,376); BezierCurveTo (566,419,554,462,542,506); BezierCurveTo (534,544,530,589,514,625); BezierCurveTo (487,682,392,696,334,695); BezierCurveTo (206,689,142,577,179,460); the strokes();   

This is useful for small characters or something that needs to be specifically seen. And @ font face is not an option

No comments:

Post a Comment