How can I know if a string is BiDi string?

M

maya

Hi,
I'm writing an application that gets a string as an input from the
user, and creates an image with this string.
The library that creates the image doesn't recognize if the string is
a right-to-left string, so in such case, I need to create a mirror
string.
How can I know if the string that I got from the user is in a BiDi
language?
Thanks,
Maya
 
V

Victor Bazarov

I'm writing an application that gets a string as an input from the
user, and creates an image with this string.

What's "an image"? What do you mean by "an image"? Some kind of graphical
representation? C++ has no means to do graphics, you know that, right? And
it is probably irrelevant, I concede.
The library that creates the image doesn't recognize if the string is
a right-to-left string, so in such case, I need to create a mirror
string.

What's "a right-to-left string"? I know a "C-string", 'std::string', even
"a string literal".
How can I know if the string that I got from the user is in a BiDi
language?

What's "a BiDi language"?

You see, all those definitions do not exist in C++ language. If you need
to explain what you mean by those, it most likely makes your question OT
here because it has no answer in C++ terms. Perhaps you need to ask in
'comp.programming' or in the newsgroup that deals with your platform.

V
 
B

benben

Hi,
I'm writing an application that gets a string as an input from the
user, and creates an image with this string.
The library that creates the image doesn't recognize if the string is
a right-to-left string, so in such case, I need to create a mirror
string.

From a data structure stand point a string of text of some
right-to-left languages such as Arabic need not be any different. It
does, however, require special handling in the printing system. Viz, the
text is stored as left-to-right and presented as right-to-left.

This is the case with most systems. I am not sure if your system is an
exception.
How can I know if the string that I got from the user is in a BiDi
language?

There are a few things you can do that relates to code pages and unicode
classification. But the detail can be better offered in other dedicated
newsgroups than this one. After all, it is not seriously a C++ Language
problem.
Thanks,
Maya

Ben
 
P

Phlip

benben said:
After all, it is not seriously a C++ Language
problem.

One more tiny detail before the thread goes to another forum:

BiDi doesn't mean right to left text. It means left-to-right phrases, such
as "George W. Bush", flow left-to-right when nested inside right-to-left
phrases, such as Arabic. Or vice versa.

This effect makes editing GUIs real fun, when the cursor flows in the
opposite direction depending on text type.

To the OP: If you use Win32, reach out for the library called Uniscribe. It
supports these kinds of GUIs, so it will have the basic methods you need.
 
K

Kaz Kylheku

Hi,
I'm writing an application that gets a string as an input from the
user, and creates an image with this string.
The library that creates the image doesn't recognize if the string is
a right-to-left string, so in such case, I need to create a mirror
string.
How can I know if the string that I got from the user is in a BiDi
language?

The internal representation of a string has nothing to do with the
direction of writing on display or input devices such as user interface
text boxes and edit controls.

A non-empty string is an object which has a first character and a last
character. These positions are abstract; they are neither left nor
right. There is no such thing as a "right to left" string. (Or there
shouldn't be. Someone out there is probably working with data in this
naive way. There is no bottom to the stupidity in the computing field).

A string object could have a display attribute which indicates how it's
to be rendered. However, standard C++ strings are not required to have
any such attribute.

If you're working with some kind of UI tookit which has these strings,
find the forum where that toolkit is discussed.
 
K

Kaz Kylheku

Victor said:
What's "a right-to-left string"? I know a "C-string", 'std::string', even
"a string literal".

A right-to-left string is an up-and-down string that has been rotated
90 degrees clockwise in memory. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top