Problem showing Greek text

Report any Hollywood bugs here
Post Reply
marko
Posts: 56
Joined: Wed Dec 15, 2010 5:19 pm
Contact:

Problem showing Greek text

Post 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
AmigaOS 4.1 on Sam440ep-flex@800MHz
http://www.m4rko.com/amiga
marko
Posts: 56
Joined: Wed Dec 15, 2010 5:19 pm
Contact:

Re: Problem showing Greek text

Post 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
AmigaOS 4.1 on Sam440ep-flex@800MHz
http://www.m4rko.com/amiga
User avatar
Juan Carlos
Posts: 889
Joined: Mon Sep 06, 2010 1:02 pm

Re: Problem showing Greek text

Post 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.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Problem showing Greek text

Post 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 :)
marko
Posts: 56
Joined: Wed Dec 15, 2010 5:19 pm
Contact:

Re: Problem showing Greek text

Post 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 :)
AmigaOS 4.1 on Sam440ep-flex@800MHz
http://www.m4rko.com/amiga
Post Reply