SVG text element with Unicode characters

后端 未结 2 1830
清歌不尽
清歌不尽 2021-01-11 10:43

First - a short description of a problem. I write a JavaScript function to put some text label\'s in SVG canvas. Here it is:



        
2条回答
  •  情深已故
    2021-01-11 11:16

    It's really easy: just put the actual Unicode characters you want into your document, save the document as UTF-8, and specify that the document is using the UTF-8 character set.

    Here's a live example on my website showing that you can use these characters:

    • In the title of the page.
    • Directly in your text.
    • Inside JavaScript strings.

    Note that I've saved this file with a UTF-8 encoding and notice that the top of the file has:

    
    

    On the off chance that my site is down, here's the content of the example:

     
     
      
      Θαρσανδαλα 
       
    
    
      
        Inline: Θαρσανδαλα
       
       
    
    

提交回复
热议问题