Text RTL

Hello everyone, just started to work with this engine today, was wondering about text alignment.

i’m exporting to html5 and the text is displaying properly, but not aligned to the right side.

i can post a screen shot, but does anyone know of a way to fix this?

thanks in advance

Hi,

Can we see a screenshot ?

thanks for the quick reply, here’s the screenshot.
as you can see the comma and quotation marks are off, and the whole line is aligned to the left.
1.PNG

Is the text displayed correctly in the editor?

only if i use ctrl+shift on the right side of the keyboard.
normally it looks just like the screenshot in the editor.

any idea how to fix this? i tried to add a dir=“auto” to the html and body in the index file, but that didn’t help. i’m guessing it’s in the java.

I think the graphics library WE use doesn’t support RTL texts well :frowning:

so the text should only be used in graphics?

so that’s it? there’s no way to align the text to the right in the java script or something?

I have tried to do it in JS (PIXI), but GD ignores the alignment, and it seems that SFML text (native platform) has no alignment option, so the only way to do it is manually set the object position.
Each time you modify the text string, you have to update its position (X is the static x position, for “right” align it’s the right side):
To align left, just set the position:

Do = X to the position of TextObject

To align center:

Do = X - TextObject.Width()/2 to the position of TextObject

And to align right:

Do = X - TextObject.Width() to the position of TextObject

Not sure if it’s what you need actually :unamused:

i’m not sure that will fix the alignment, things like commas will still align left by default.

Sorry, as you can notice I’m very “ignorant” on this topic, the commas are different? Maybe mirrored? Then AFAIK you’ll have to find a custom font that has such symbols as default ones, so no need to generate a full alignment system… because there is not one in GD :frowning:

you can see the screen shot i uploaded before, and notice the position of the quotation marks.

Any news on this topic?
I realy miss the right to left alignment