.
Definitively, the arabic fonts are missing.
Here is a workaround to display arabic words in Celestia.This is not the only way to do it, but maybe you find it useful.
1) Building the font for Celestia.I have built a txf font with arabic characters (and also the latin ones, so you can use it to write any kind of text including special west-europeans letters with accents.
The base font is the simpo.ttf font that I found here.
https://cooltext.com/Fonts-Unicode-ArabicI choosed this font because the latin characters in it match well withe the usual celestia fonts.
Of course another font is maybe better for arabic characters. Please tell me.
I gave the name simpo24_ar.txf to this font.
I got it withe this command :
ttf2txf -w 1048 -h 1048 -f codepoints_ar.txt -s 24 -o simpo24_ar.txf simpo.ttf
I join this font to this message.
2) copy this font in the fonts directory of Celestia.3) In the celestia.cfg file, replace the sansbold20.txf with simpo24_ar.txf as TitleFont Code: Select all
Font "sans12.txf"
LabelFont "sans12.txf"
# TitleFont "sansbold20.txf"
TitleFont "simpo24_ar.txf"
Now you shoud be able to print arabic text using the celestia:print() or celestia:flash() functions.
But there is still a problem : As I guessed, these functions don't manage the right to left order of arabic scripture and the text is written in reverse order.
To fix this issue, I have created a little lua function that reverse the order of a utf-8 text.
Here is a minimal script as exemple.
Code: Select all
local function utf8inverse(s)
local inverse="";
local i=1
while (i <= string.len(s)) do
local car,b
b=string.byte(s,i)
if b<128 then
car = string.char(b);
i=i+1
elseif b<224 then
car = string.sub(s,i,i+1)
i=i+2
elseif b<240 then
car = string.sub(s,i,i+2)
i=i+3
else
car = string.sub(s,i,i+3)
i=i+4
end
inverse = car..inverse
end
return inverse
end
celestia:print(utf8inverse("هذا النجم الدبران") , 60,0,0,-12,-3)
And a screen copy of the result.
(click for a bigger view)
I Hope it make sense
I used google to translate from French to Arab.
Download the font from here: