Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://stackoverflow.com/questions/604993/is-it-possible-to-detect-east-asian-language-support
- http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript
- <html>
- <head>
- </head>
- <body>
- <script language="javascript" type="text/javascript">
- function length_of_char(str){
- var div = document.createElement('div');
- div.style.height='auto';
- div.style.width='auto';
- div.style.visibility='hidden';
- div.style.position='absolute';
- div.style.borderWidth='0px';
- div.appendChild( document.createTextNode(str) );
- document.documentElement.appendChild(div);
- return div.clientWidth;
- }
- var l1= length_of_char('\u30A2');
- var l2= length_of_char('\uFF71');
- console.log( l1 );
- console.log( l2 );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment