How to split non-english text into component characters in javascript?

I am trying to draw text along a curve on html5 canvas. To do this, I need to break the input text into component characters that can be individually rotated and translated, etc. Text break is easy for English. Given the input string s, s[i]gives the i-th character. But this does not work for non-English strings. I have a jsfiddle illustrating a problem: http://jsfiddle.net/c6HV8/ . Please note that the script looks different in Chrome and IE at the time of this writing. To find out what the problem is, think that you have non-English text in the line s. Create the node text you are going through s. Then create node text for eachs[i]and display text nodes adjacent to each other. Now compare the results. They are not the same. How can I split non-English text into component characters in javascript so that both results are the same?

enter image description here

+4
source share
1 answer

भाईसाब:) , , , fillText createText ( ). , fillText createText , , . , , ( , : ).

. :

  • .
  • , , .
  • fillText.

. , , , . ; .

, . , .

+2

Source: https://habr.com/ru/post/1526404/


All Articles