right refrence point on Text doesn't work on Hebrew Text

anybody ?

Hi @Mars Interactive,

Does the same thing occur if you simply place this text on the stage, and not within the scrollView widget? Please test this and let me know what happens.

Thanks,

Brent

thank you for the reply !

yes, i just checked and it happens with plain text outside of the text box as well.

in got this app built in obj C for iphone and there it aligned perfectly to the right, so i know it’s possible.

just can you fix it ? or give me a way to fix it ?

Hi @Mars Interactive,

Can you perhaps show me a screenshot of this? Also, when you do this (after the text is displayed):

[lua]

print( lotsOfTextObject.width )

[/lua]

What is the value you receive? And when you increase the text size, does that value change as expected, smaller or larger as you adjust the size?

Regards,

Brent

well if i put it in a text box 

like:

hebrewText = display.newText (hebrewTextShort,  200, 200, 0, 0, nil, 30)

then it is the same width as the long text:

hebrewText = display.newText (hebrewTextLong,  200, 200, 0, 0, nil, 30)

and then it cannot align to the right.

BUT

if i do it without the text box

hebrewText = display.newText (hebrewTextShort,  0, 0, nil, 30

hebrewText = display.newText (hebrewTextLong,  0, 0, nil, 30

It IS different width

thanks for helping Brent .

regards

shay

should_Be_Aligned.jpg

here is a screenshot

Ah, I think now we got your problem.

What I understood at first was, that setReferencePoint didn’t work. But you’re not able to set the text alignment with that, cause that only works for text with no given width.

What you could try is to split up your text in lines and set the reference point for every line to the right.

You can try to use the module I scripted as well, but I don’t know if it works with hebrew letters.

http://developer.coronalabs.com/code/fontbox-finally-way-format-text

well it’s a great function ! 

but it doesn’t work with Hebrew…

when i build the app it comes out as signs on the screen

how can i use just the usual native systemfont ? instead of adding a costume font of my own ?

i just noticed somthing else, if i write ANY hebrew letter and do to it, >      letter:sub(i, i)

then i get it allways with question mark if i try to put it on display

Yeah, I already assumed it would not work.

The thing ist that string functions as letter:sub(i,i) work with bytes instead of characters. And every character that is not in the ASCII table has more than 1 byte. And if you try to display a byte of a character with several bytes you get a questionmark in most cases.

So the only thing you can do (as I mentioned before) is to display each line on it’s own and align them to the right.

Hi @Mars Interactive,

So, if I understand correctly, you want to align each line of a multi-line text box to the right, as “right-align” would do in a standard layout/type program? For example, the same as the list of ingredients in your screenshot, but applied to the numbered steps?

If so, you may want to test out the new text alignment feature which was released in Build #1143 (sorry @torbenratzlaff, it’s only available to Pro users at this time). This should allow you to align the text left, center, or right within a text box. It’s a brand-new feature and I’d like to hear your testing reports using it, especially with Hebrew text.

Thanks,

Brent

Ah, great to hear that it’s finally implemented.

But it’s sad, that my module got a bit obsolet for pro users now :wink:

Torben, please don’t be sad. Your module still does quite a bit on top of alignement in the formatting areas. Perhaps once you get access to the new features you can update your module to be lighter since you will not have to do the grunt work for alignment anymore. Thanks for your past and future efforts. All very appreciated. 

I WOULD like to align the text box of course, not individual lines.

i will use the new text alignment feature and will say how it aligns the text with hebrew letters because up until now it couldn’t align the text boxes, to the right,

do i just use it normal ? and to tell you if it aligns to the right ?

because as i opened the message up until now it didn’t aligned with this code

as in here >

local lotsOfTextObject = display.newText( pData.desc:value(), 0, 0, 380, 0, native.systemFont, 22 )

        lotsOfTextObject:setTextColor( 255, 255, 255 ) 

        lotsOfTextObject:setReferencePoint( display.TopRightReferencePoint )

        lotsOfTextObject.x = 390

        lotsOfTextObject.y = 0

        scrollView:insert( lotsOfTextObject)

 

?

Works great!!! See attached. Thanks for making it happen.

well it still doesn’t work in hebrew, 

excetly the same result as in the picture i added

the code i’m using is this:

local lotsOfTextObject = display.newText( txt, 0, 0, 320, 0, native.systemFont, 22 )

lotsOfTextObject:setTextColor( 255, 255, 255 ) 

lotsOfTextObject:setReferencePoint(display.CenterRightReferencePoint);

        

lotsOfTextObject.x = 390

lotsOfTextObject.y = 0

please can you fix this ?

ksan how did you use it ? can i see the code ? did you used it as i do ?

OK

soo i used it now as a TEXTBOX not plain text

with the NEW BUILD

and it aligns perfactly to the right

thanks soo much.

works like a charm !

Sorry for my late reply. Great to hear you got it working. I just used the example in the updated docs. All the best.