How to align text from both sides ?

:)  أحسنت يا مبدع

just noticed one thing… if you reduce the width of text using  maxWidth  , The text x position will slide lttle to the left. I am not sure if this normal behaviour. As per my understanding , it should shorten the width of the whole text but not changing the x position of it.

thanks

Abdul

[quote name=“Gremlin Interactive™” post=“254159” timestamp=“1404294423”]@Ingemar, nice stuff dude ;)[/quote] Absolutely amazing!!!

@alzaabi98

I’m not sure what you mean.

However in your example, if you reduce maxWidth it will seem like you end up with a wider right margin, right? However it isn’t. The display group returned by my function knows nothing about its parent, so if you reduce maxWidth, you’ll need to adjust the x property so that it will be placed properly within its container.

If you look at the sample project on github, I’ve set paragraph.x=10 to position it properly within the scrollview. If you change the width of the scrollview or maxWidth, you’ll need to adjust the x property accordingly.

exactly… That what I did … If I reduce the maxwidth, i change the x proprety to poistion it again to right , and it worked nicely…

 

thanks

Abdul

@alzaabi98

Great!

@ingemar: happy to revive this old thread just to say thanks (as always!) - this module helped me out in a big ol’ time crunch, keeping my client happy with me. You da man!

Thanks! Glad that it was useful  :slight_smile:

@ingemar: happy to revive this old thread just to say thanks (as always!) - this module helped me out in a big ol’ time crunch, keeping my client happy with me. You da man!

Thanks! Glad that it was useful  :slight_smile:

@ingemar: Thanks! That is a great, really needed, and works like a charm!

Also, it is easy to modify to add a lineHeight parameter (line spacing) which is also currently lacking in Corona.

31 - options.lineHeight = options.lineHeight or 0

88 - local lineHeight = output[1].words[1].height+options.lineHeight

Thanks again, great work!

@ingemar: Thanks! That is a great, really needed, and works like a charm!

Also, it is easy to modify to add a lineHeight parameter (line spacing) which is also currently lacking in Corona.

31 - options.lineHeight = options.lineHeight or 0

88 - local lineHeight = output[1].words[1].height+options.lineHeight

Thanks again, great work!