Posts: 35
Threads: 5
Joined: Apr 2022
Reputation:
5
I would like to ask a question to the community here.
How easy is it for QB64 to support the Greek language?
That is, what is written in quotation marks.
For example,
PRINT "Den ypostirizo ellinikoys xaraktires>"
PRINT "I do not support Greek characters."
PRINT "Δεν υποστηρίζω ελληνικούς χαρακτηρισμούς."
SLEEP
Copy this little example and you'll see exactly what I mean.
I would like one day to be able to make my own programs and insert Greek characters where needed.
Thank you very much for your valuable time.
Postscript. I hope I wrote it in the right place.
Posts: 3,974
Threads: 177
Joined: Apr 2022
Reputation:
219
Man what a thing it would be to be able to get different languages translated to ones own native language both in IDE and output!
On a similar line translate different programming languages to and from QB64!
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
The QB64 IDE has one incredibly large limitation to it -- it's written in SCREEN 0. At most, it can only display a variety of 256 characters onto the screen. Usually these are the standard 256 ASCII characters that you see and get with the default code page.
The only way to get those extra characters to show and display easily, is to swap some of our standard characters out for the symbols needed. The easiest way to do that is with the _MAPUNICODE command. 437 is the default page, which we're all used to using. 737 is the page for Greek characters, which probably has all the characters you're looking for on it.
And, if you've got a keyboard which types those characters for you with just a single keystroke (rather than having to hit alt+number codekeys), then you might want to look into using my KeyHit Library, where you can custom configure it to work with whatever keyboard layout you might have.
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
11-21-2022, 03:51 PM
(This post was last modified: 11-21-2022, 03:53 PM by mnrvovrfc.)
I adapted the example from here:
https://qb64phoenix.com/qb64wiki/index.php/MAPUNICODE
Then pasted the "CP737" instead of "CPMIK", and finally, below the example program, the code contributed by the OP.
Code: (Select All) Screen 0
$IF WIN THEN
_FONT _LOADFONT("C:\windows\fonts\cour.ttf", 20, "MONOSPACE")
$ELSE
_Font _LoadFont("/usr/share/fonts/TTF/NotoSansMono-Regular-Nerd-Font-Complete.ttf", 20, "MONOSPACE")
$END IF
Restore Microsoft_pc_cp737
For ASCIIcode = 128 To 255
Read unicode
_MapUnicode unicode To ASCIIcode
Next
For i = 128 To 255
Print Chr$(i) + " ";
cnt = cnt + 1
If cnt Mod 16 = 0 Then Print
Next
Print "Den ypostirizo ellinikoys xaraktires>"
Print "I do not support Greek characters."
Print "Δεν υποστηρίζω ελληνικούς χαρακτηρισμούς."
Sleep
End
Microsoft_pc_cp737:
'Microsoft_pc_cp737
Data 913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928
Data 929,931,932,933,934,935,936,937,945,946,947,948,949,950,951,952
Data 953,954,955,956,957,958,959,960,961,963,962,964,965,966,967,968
Data 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
Data 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
Data 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
Data 969,940,941,942,970,943,972,973,971,974,902,904,905,906,908,910
Data 911,177,8805,8804,938,939,247,8776,176,8729,183,8730,8319,178,9632,160
It didn't work because different high-bit characters have to be used. Yet all the Greek letters exist, at least in one of the fonts in my system (I'm using Linux/Manjaro MATE):
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
Actually it didn't work because I copied-pasted directly from this forum. The OP could try running his/her program again but only changing the codepage and the font before printing.
Posts: 73
Threads: 9
Joined: Apr 2022
Reputation:
6
Parenthetically, not trying to be offensive here but rather pointing out an objective oddity, it is very doable to write Greek and Russian using the Roman alphabet, while not so easy to write Chinese that way.
|