Page 1 of 1

Problem showing Greek text

Posted: Sat May 07, 2016 2:55 am
by marko
Hello Andreas,

One of my programs is translated to many languages, but I have issues with the Greek text...

I'm unable to show Greek text in a Window, I have tried different methods but it doesn't work :SSS However the Greek text shows up correctly in the Shell if it's printed with DebugPrint (given you have set to Greek locale in Prefs), but not in the Window :/ Have I missed something, help??

I have HW 6.1 and AmigaOS 4.1 FE on Sam440ep-flex.

Here's screenshot:

Image

Re: Problem showing Greek text

Posted: Sat May 07, 2016 3:00 am
by marko
And here's the source of the test code:

Code: Select all

@DISPLAY {Title="GreekTextTest", Width = 320, Height = 256, Color = $D6D6D6, NoHide = TRUE}

;-- START Greek text test ------

SetFont(#SANS, 16)
SetFontColor(#BLACK)
SetDefaultEncoding(#ENCODING_UTF8)

a$ = "1: Äçìéïõñãüò"
b$ = "2: Äçìéïõñãüò"
c$ = "3: Äçìéïõñãüò"

Locate(10, 10)
Print(a$)
DebugPrint(a$)

TextOut(10, 30, b$, {Encoding=#ENCODING_UTF8})
DebugPrint(b$)

CreateTextObject(1, c$, {Encoding=#ENCODING_UTF8})
DisplayTextObject(1, 10, 50)
DebugPrint(c$)

;-- END Greek text test ------
	
Repeat
	WaitEvent
Forever

Re: Problem showing Greek text

Posted: Sun May 08, 2016 2:17 pm
by Juan Carlos
And with the Polish?, because some problems with Hollywood programs to show text is with special charapters of languages, polish, czech, and greek, I think also with russian.

Re: Problem showing Greek text

Posted: Sun May 08, 2016 10:12 pm
by airsoftsoftwair
This is not a bug.

When using UTF-8 encoding, you have to make sure to pass correct UTF-8 characters to Hollywood. This can be quite complicated because Hollywood currently can't open UTF-8 encoded scripts. Thus, you have to look up the individual UTF-8 sequences and then compose them manually. For example, AFAICS, the first character of your Greek text is the delta character. In UTF-8, the delta character is represented by two bytes: $CE and $94. Thus, if you want to print a delta in Hollywood, you have to use the following code:

Code: Select all

SetFont("Arial", 32)
SetFontColor(#WHITE)
SetDefaultEncoding(#ENCODING_UTF8)
TextOut(0, 0, Chr($CE) .. Chr($94))
Note that I'm using Arial because #SANS doesn't have the Greek delta character.

This should all get much easier once Hollywood supports loading UTF-8 encoded scripts. Then you can just use non-ISO-8859-1 characters in your script and don't have to worry about raw UTF-8 encoding but since at the moment Hollywood expects each script to be in ISO-8859-1 encoding, you have to go to some pains if you want to use non-ISO-8859-1 characters. But it's not that complicated. You could just create some mapping tables for the languages you need and then it should be quite straight-forward. But make sure that the fonts you use actually have those characters in their character set!

You can also ask Lazi... he is from Hungary which is outside the ISO-8859-1 scope so he should be quite familiar with this :)

Re: Problem showing Greek text

Posted: Mon May 09, 2016 1:54 am
by marko
@airsoftsoftwair
Chr($CE) .. Chr($94)
Aah, I tried to compose UTF-8 characters like printing Chr($CE94), but that was wrong I see, thank you for setting me straight :D
Note that I'm using Arial because #SANS doesn't have the Greek delta character.

This should all get much easier once Hollywood supports loading UTF-8 encoded scripts. Then you can just use non-ISO-8859-1 characters in your script and don't have to worry about raw UTF-8 encoding but since at the moment Hollywood expects each script to be in ISO-8859-1 encoding, you have to go to some pains if you want to use non-ISO-8859-1 characters. But it's not that complicated. You could just create some mapping tables for the languages you need and then it should be quite straight-forward. But make sure that the fonts you use actually have those characters in their character set!
Thank you Andreas, I should manage now with the pointers given, much appreciated :)