How can I write some text in .cel script?

All about writing scripts for Celestia in Lua and the .cel system
Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

How can I write some text in .cel script?

Post #1by fly_space » 18.11.2010, 03:09

Hello.

I want to write Korean consonant and vowel(
koreanconsonantvowel.jpg
), special text (like ?,?,?) in .cel script.

but when I run script in celestia,(
consonantvowelspecialtextcel.jpg
)

some texts turned into '?' (
consonantvowelspecialtexterror.jpg
)

How can I write that texts perfect?
Last edited by fly_space on 11.08.2011, 10:24, edited 2 times in total.
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years
Location: Paris France

Re: How can I write some text in .cel script?

Post #2by jogad » 19.11.2010, 19:06

Hello

This is not a script issue but rather a font issue.
These characters are just missing in the font used by Celestia to display the text of the script.

I think that we can report this as a bug.

Until the Celestia team fixes it with a consistent solution, here is a workaround.

- Save and rename the file sansbold20_ko.txf in the font directory of Celestia.
- Download the file that you will find here:
http://www.sendspace.com/file/sz0fhk
(dont be confused by advertising, the link is at the bottom of the page)
- Unzip the file (sansbold20_ko.txf) in the font directory of Celestia

I get this result.

Image

For what is worth, the missing characters are in the range of unicode 1100 to 11FF

Well. This is only a workaround:
the font is different from the other Celestia smaller fonts. Moreover the file if rather big. Optimizations should occur. At last as I cannot read korean, I took the whole range from unicode AC00 to D7A3 for the hangul characters. It is maybe too much but I cannot help on this.

About the special characters like little heart or star, this is another story. These characters depend on the font in use and maybe there is no general solution for that.

regards

Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

Re: How can I write some text in .cel script?

Post #3by fly_space » 21.11.2010, 02:02

jogad,

Sorry, but it worse than before.
consonantvowelspecialtexterrornew.jpg


but I don't know that this problem just happen to me, So I'll say this problem to my friends.
and I'll reply again.

-
My font directory is this
fontdirectory.jpg
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years
Location: Paris France

Re: How can I write some text in .cel script?

Post #4by jogad » 21.11.2010, 09:06

Hi

fly_space wrote:but I don't know that this problem just happen to me, So I'll say this problem to my friends.
and I'll reply again.

Yes. There is actually not one problem but two problems.

I was surprised that you get some of the characters in your first screensho :roll: t. Because these caracters are actually missing in the default korean Celestia font.
The reason is probably that your text was not if the correct UTF-8 format. And your text editor performed some substitutions with geometric caracters in the default font.

Check your encoding.

notepad.png


When you open your script in notepad2 your must see ANSI as UTF-8 at the bottom of the window.

Does this help?


c

Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

Re: How can I write some text in .cel script?

Post #5by fly_space » 23.11.2010, 12:22

I set UTF-8 already...

encoding.jpg
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years
Location: Paris France

Re: How can I write some text in .cel script?

Post #6by jogad » 23.11.2010, 15:02

Hi,


It is very frustating because I can get it on my French machine and you cannot on your korean computer.

I have no much more idea of what is wrong.

One thing to try yet:
This is the script that works fine on my system.
korean.zip

Unzip but do not edit it and see if it works for you. (With the font you downloaded before).

And post your own script as an attached file (just in case...)

Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

Re: How can I write some text in .cel script?

Post #7by fly_space » 04.12.2010, 05:43

Sorry, I was busy bacause an achievement test period Now.

I can't attatch My script (The extension cel is not allowed.)
So I give address about My blog post which have the script file.

http://blog.naver.com/wjdeogks18/10098651563
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years
Location: Paris France

Re: How can I write some text in .cel script?

Post #8by jogad » 04.12.2010, 16:43

Hi,
fly_space wrote:I was busy bacause an achievement test period Now.
Best whishes to you for that :wink:

fly_space wrote:I can't attatch My script (The extension cel is not allowed.)
So I give address about My blog post which have the script file.
Yes. This is why I have zipped my script into a .zip file to post it.
Please use this method next time. It was not so easy for me to find the script among the korean text :oops:

Ok! the result is that my script works with the new font and yours does not. 8O
Once again this is a problem to have the right match between the caracters coded in utf8 and the ones which actually belong to the font.

The font that I posted uses the set 1100 to 11ff set of characters listed here
http://www.unicode.org/charts/PDF/U1100.pdf
And my script uses these characters.

Your script uses this set of characters:
http://www.unicode.org/charts/PDF/U3130.pdf
And they do not belong to the font.

You must produce a font that includes these codes from a korean ttf font.
You'll find a useful documentation to do that in the celestia wiki here:
http://en.wikibooks.org/wiki/Celestia/I ... nalization
(just look at the 'Building .txf font texture file' chapter)

You can use this text file to generate your font.
coreen2.zip
ah ah :lol: the .txt extension is not supported either :!:

Korean jamo are included but not the special chars. If you need them they are here:
http://www.unicode.org/charts/PDF/U25A0.pdf
http://www.unicode.org/charts/PDF/U2600.pdf

Regards :mrgreen:

Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

Re: How can I write some text in .cel script?

Post #9by fly_space » 11.12.2010, 03:54

Hi,

I can't get txf utility because http://www.celestiaproject.net/~claurel/stuff/txfutil.tar.gz is prosen.

also, I don't know How can I 'Generate the .txf files' step. just copy and tipping each lines,
and save 'sans12_LL.txf', 'sans14_LL.txf' , 'sansbold20_LL.txf?'

(like this.
sans12_LL.txf ->ttf2txf -w 1048 -h 1048 -f codepoints_LL.txt -s 12 -o sans12_LL.txf font.ttf
sans14_LL.txf ->ttf2txf -w 1048 -h 1048 -f codepoints_LL.txt -s 14 -o sans14_LL.txf font.ttf
sansbold20_LL.txf ->ttf2txf -w 1048 -h 1048 -f codepoints_LL.txt -s 20 -o sansbold20_LL.txf font_bold.ttf
)
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years
Location: Paris France

Re: How can I write some text in .cel script?

Post #10by jogad » 11.12.2010, 16:14

Hi Fly_space,

Glad to see that you do not give up! :D

Sorry! My explanations were not enough explicit and the available documentation that I pointed is rather short. :(

I'll try to give some precisions on how to do that step by step.

fly_space wrote:I can't get txf utility because http://www.celestiaproject.net/~claurel/stuff/txfutil.tar.gz is prosen.

This is is true but it is a problem only if you work with linux.
Most probably you have Windows and in this case the important link is the following:

Note for Windows users:
A pre-compiled version of ttf2txf is available at: http://gvince.perso.sfr.fr/celestia/dev/ttf2txf.zip
1) download this archive and extract the files in a directory of your choice. Say "txffonts".
- This directory contains now 5 files. (have a look at the readme.txt)

2) choose the korean font that contains all the characters you need, including the missing characters.
The easiest is to take the font used by your text editor to show the text of the script. This way you are sure that the required characters are present.
I call this font "font.ttf". You have to replace "font.ttf" by the actual name of that font.

3) copy "font.ttf" from the fonts directory of Windows to your newly created "txffont" directory

4) build the font
The font to build is sansbold20_ko.txf (the _LL means the 2 letters of the locale font)
Don't bother with sans12 and sans14. These fonts are not used to display scripts and have the required characters to display what is worth.

The command line
ttf2txf -w 1048 -h 1048 -f codepoints_LL.txt -s 20 -o sansbold20_LL.txf font_bold.ttf
becomes a little more explicit:
- ttf2txf is the conversion program
- sansbold20_LL.txf must be replaced by sansbold20_ko.txf
- font_bold.ttf must be replaced by your own korean ttf (true type) font
- maybe the given values for the font size(1048, 1048) are too small for an asian font and we'll have to find better values

But the codepoints_LL.txt remains mysterious. It is only a txt file that contains the list of the caracters' codes to include in the font.
codepoints_ko.txt contains "only" the 487 characters that are necessary to ensure the translation of Celestia. If your script uses other characters they will be missing.
The problem is to find a replacement file for codepoints_ko.txt. This is why I proposed the "coreen2.txt" in my previous post. This file contains 11456 codes of characters. Maybe it is too much but I cannot read korean and I cannot say more on this. Any help is welcome.
Anyway if you agree to use my coreen2.txt file instead of codepoints_ko.txt:

- copy coreen2.txt into the "txffonts" directory
- open a command window in this directory
- try to type the command line by replacing the parameters. In my example I use arialuni.ttf as korean source font and I get this:

buildfont.png

As you can see, the font is generated but the error message indicates that the texture is too small and then only 2486 characters (instead of 115456 as expected) are taken into account.

The solution is to increase the size of the texture. With -w 2480 and -h 2048 I get:

buildfont2.png

This time there is no error and the font is created correctly.
The correct values depend on the font you have chosen.
You have to experiment a bit :? but I suppose that you can take these value as a starting point.

- copy the newly created sansbold20_ko.txf in the "fonts" directory of celestia and you are done! :mrgreen:

PS
This is a kind of tutorial on how to build a txf font but not a definitive solution.
? propos... What is the original font used to generate the Celestia's korean font?
:?: Who knows? Chris? Vincent? an idea for an effective solution? :?:

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 8 months
Location: Nancy, France

Re: How can I write some text in .cel script?

Post #11by Vincent » 11.12.2010, 17:50

jogad wrote:This is a kind of tutorial on how to build a txf font but not a definitive solution.
? propos... What is the original font used to generate the Celestia's korean font?
:?: Who knows? Chris? Vincent? an idea for an effective solution? :?:
Hi Jo?l,

The Korean font texture was provided by our Korean translator Seung-Bum Lee.
One should be able to contact him via the email adress which is published on the
Celestia i18n Wiki page:
http://en.wikibooks.org/w/index.php?tit ... n&stable=0
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
fly_space
Posts: 41
Joined: 23.10.2008
With us: 15 years 11 months
Location: Seongnam, Korea

Re: How can I write some text in .cel script?

Post #12by fly_space » 08.01.2011, 11:50

Hello, Happy New Year! :D

-

Actually, I can't solve this problem yet :(
But I still try to solve that solution. (+I need some information... But I don't know perfectly that information is what. give me more times... :? )
KCU(Korean Celestia User)
http://blog.naver.com/wjdeogks18 (My Blog)
I wished to be a Developer, and I actually did.
I still want to be a poet, too


Return to “Scripting”