How can i use greek font?

Started by george, August 30, 2020, 08:56:50

Previous topic - Next topic

george

Hello guys , i want to write Greek texts in max2d , but i don't know how .I want to create a text game .Thanks for you time .

e.g.

Graphics 600,600

Repeat

   Cls
   DrawText ("Γεια σου κόσμε , πάτησε το πλήκτρο 'esc' για να βγεις ",300,300) ' it shows only the 'esc' the Greek texts are invisible.
   Flip
   
Until KeyHit(key_escape)

george

Is there any example for how can i do this ?

Derron


george

#3
I found a .tff here http://www.fontsaddict.com/font/korinthus-italic.html

Graphics 600,600
Local font:TImagefont = LoadImageFont("KORINTHI.ttf",2,style=SMOOTHFONT)
SetImageFont(font)
Repeat

   Cls
   DrawText ("Γεια σου κόσμε , πάτησε το πλήκτρο 'esc' για να βγεις ",300,300)
   Flip
   
Until KeyHit(key_escape)


When i am building it , i'm taking an error" compile error identifier 'style' not found ."

george

#4
Ok , it's works, but without tones  . For some reason i need to write greeklish  to works  . Thanks for help  .

Graphics 600,600
Local font:TImagefont = LoadImageFont("KORINTHI.ttf",20,SMOOTHFONT )

Repeat

   Cls
   SetImageFont(font)
   DrawText ("Geia sou kosme , pathse to plhktro ",10,300)
   SetImageFont(Null)
   DrawText("esc",330,310)
   SetImageFont(font)
   DrawText("gia na  bgeiq ",360,300)
   Flip
   
Until KeyHit(key_escape)

Derron

Code (Blitzmax) Select

SuperStrict

Graphics 600,600
Local txtFile:String = LoadText("utf8::text.txt")
local txtRaw:String = "Γεια σου κόσμε , πάτησε το πλήκτρο 'esc' για να βγεις"

Local font1:TImagefont = LoadImageFont("KORINTHI.TTF",22, ITALICFONT)
'fonts https://fonts2u.com/attikau.font
Local font2:TImagefont = LoadImageFont("AttikaU.ttf",22, ITALICFONT)

SetBlend AlphaBlend
Repeat

   Cls
 
'korinthi
   SetImageFont(font1)
   DrawText ("ASCI Hello World",10,50)
   DrawText (txtRaw,10,100)
   DrawText (txtFile,10,150)
   DrawText (Chr(69)+Chr(70)+Chr(71)+Chr(72),10,200)
   
   DrawLine (0, 300, graphicsWidth(), 300)

'attika unicode
   SetImageFont(font2)
   DrawText ("ASCI Hello World",10,350)
   DrawText (txtRaw,10,400)
   DrawText (txtFile,10,450)
   DrawText (Chr(69)+Chr(70)+Chr(71)+Chr(72),10,500)

   Flip
   
Until KeyHit(key_escape)



Your font does display characters - but maybe for greek code page encoding, not unicode. ISO-8859-7 ... maybe.


So I used a font which contains the unicode characters.


result:



As you see, the one line which adds "normal character codes" (Chr(69), Chr(70) etc - E ...F ...G ...H) does display something in the one line in "Greek" ... but in the unicode font, EFGH stay EFGH while the "greek" stuff can still be used.


So in other words: your font draws "A,B,C ..." as something "greek" and your text could be displayed as "latin". Just imagine having a font which draws a "laughing emoticon" instead of "A" ... if you wrote then "AAA" in your editor (using your latin alphabet) and render it with "your font" you will get ... laughing emoticons.
Remember Windows "wingdings.ttf" or "symbols.fnt" ? They do this.

But if you really wrote "unicode" then you would not write "A" but ... some unique char code. And your greek text is doing this - hence you need a unicode font.



bye
Ron

george

 :) Thank you very much Derron , This is really very interesting . I will study it .

makis


Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

george

Yes makis i am , are you too ? Steve Elliott  Yammas!  ;D

makis


Steve Elliott

lol we go to Greece every year (apart from this year for obvious reasons).  It would be great to speak proper sentences in Greek but the language seems soo difficult to learn!
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Steve Elliott

lol it had to be said, you couldn't resist it could ya?   :))
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Derron

It's all Spanish for me ... this is what we say in Germany ... seems we all have our "mysterious" language :D


bye
Ron

takis76

I am Greek too.  ;D
This programming language is wonderful and the community here is even more wonderful than the programming language too.