About Monkey 2 › Forums › Monkey 2 Development › extended ascii chars
This topic contains 3 replies, has 3 voices, and was last updated by
Mark Sibly
2 years, 6 months ago.
-
AuthorPosts
-
October 11, 2016 at 4:08 pm #4404
I’ve noticed that no chars upon 127 would print or DrawText even though I give the canvas a .ttf font that supports extended ASCII characters.
The same happens in Ted2. I can’t write some french text in Ted2!
Having only the ANSI char set is a big issue to me..
Here is a small code to illustrate it:[/crayon]Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243[crayon-5cba169dbe76a220272602 inline="true" ]#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowField theFont:FontMethod OnRender( canvas:Canvas ) Overridecanvas.Font = Font.Load( "C:\Windows/Fonts/comic.ttf", 18 )Local s:StringFor Local i:=0 To 255Local j:=iLocal k:=15RepeatIf j>616/10j=j-616/10k=k+30EndUntil j<=616/10s=String.FromChar(i)Print s[0]+" "+scanvas.DrawText( s,j*10,k )Nexts="elegant"For Local i:=0 To 6Print s[i]+" --> "+String.FromChar(s[i])NextPrint "--------"'s="ᅢlᅢgant" 'this contains 2 special "e" for elegant in frenchs="élégant" 'this contains 2 special "e" for elegant in frenchFor Local i:=0 To 10Print s[i]+" --> "+String.FromChar(s[i])NextEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndNotice that “élégant” is taking 10 chars in the string and “é” are not visible in Ted2. And that when copy/pasted from Ted2 the char has been transformed though you can create a string containing the char(233) with String.FromChar(233) wich is “é”.
October 12, 2016 at 7:41 am #4408I have the same problem, and created a github issue here : https://github.com/blitz-research/monkey2/issues/83
October 14, 2016 at 3:01 pm #4434@Mark: Fix working on Ted2’s text screen and mojo apps!
However the console output is still 7bit limited.. Not vital but could probably be quickly corrected after this utf8 fix.
[/crayon]Monkey12345678910111213[crayon-5cba169dc424b695269619 inline="true" ]#Import "<std>"Using std..Function Main()Local s:StringFor Local j:=0 To 3s=""For Local i:=1+(j*63) To 63+(j*63)s=s+String.FromChar(i)NextPrint sNextPrint "éléphant"EndOctober 16, 2016 at 3:09 am #4440Should be working now.
-
AuthorPosts
You must be logged in to reply to this topic.