finding "line-breaks" in textarea that is word-wrapping ARABIC text

Posted by Irfan jamal on Stack Overflow See other posts from Stack Overflow or by Irfan jamal
Published on 2011-01-18T01:48:41Z Indexed on 2011/01/18 1:53 UTC
Read the original article Hit count: 539

Filed under:
|
|

I have a string of text that I display in a textarea (right-to-left orientation). The user can resize the textarea dynamically (I use jquery for this) and the text will wrap as necessary.

When the user hits submit, I will take that text and create an image using PHP, BUT before submitting I would like to know where the "line-breaks" or rather "word-wraps" occur.

Everywhere I have looked so far only shows me how to process line-breaks on the php side. I want to make it clear that there ARE NO LINE-BREAKS. What I have is one LONG string that will be word-wrapped in different ways based on the width of the textarea set by the user.

I can't use "columns" or any other standard width representation because I have a very complex arabic font that is actually composed of glyphs (characters) of numerous different widths.

If anyone knows of a way of accessing where the word wraps occur (either in a textarea or a div if need-be), I'd really like to know.

My only other solution is to actually store (in my DB) the width of every single character (somewhat tedious since there are over 200 characters in 600 different fonts, for a total of...some huge number).

My hopes aren't high, but I thought I would ask.

Thanks

i. jamal

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about textarea