Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages
Started by eric67
Fri, 19 May 2006 18:20
Word wrapping RTL and LTR mixed scripts with Uniscribe
Author: eric67
Date: Fri, 19 May 2006 18:20
Date: Fri, 19 May 2006 18:20
51 lines
3228 bytes
3228 bytes
I need a custom win32 component to display unicode text on both W9X and XP. I've been working on a Uniscribe based component last week (using catch22.net tutorial and CSSamp from Microsoft SDK). I've written from scratch a word wrapping algorithm (since CSSamp is buggy: it works only for LTR scripts) Everything works fine but word wrapping on bidi RTL scripts (my algorithm actually works on simple LTR or RTL scripts: the problem is word wrapping on mixed RTL and LTR scripts). Both TextOutW and Gdiplus::DrawString produce wrong output when word wrapping bidi RTL scripts. I found a test page here: http://people.w3.org/rishida/scripts/samples/wrapping.html My component works fine on all LTR scripts and gives partially wrong results on the the arabic and hebrew scripts (actually it doesn't work when i need to wrap between two words of an embedded LTR script; everything works fine if embedded LTR scripts are one word long). Uniscribe ScriptItemize breaks the arabic text from the above test page into 9 items: |ARABIC A|456|-|123|ARABIC B| (|global design|) |ARABIC C| the Uniscribe bidi algorithm says that all uppercase items, <-> are RTL (numbers are LTR with RTL layout) while lowercase english and the two brake items around and are LTR items When word wrapping between "global" and "design" i get: line 1: | global|) |ARABIC C| line 2: |-|123|ARABIC B| (|design| line 3: |ARABIC A||456| I don't understand how to implement this logic in Uniscribe i.e.: 1) how to interpret valid break points using fSoftBreak and fWhiteSpace in SCRIPT_LOGATTR when this flags are set on LTR-RTL item boundaries 2) i've understand how to break an item to perform simple wrapping but i can't understand the reordering logic needed to get < global> and <) > on the first line and < (> and <design> on the second (note that Explorer keeps the blank between global and design as the trailing blank - before global- on the first line!) Is there any Unicode guru out there? I need HELP! Thanks in advance. (I'm sorry for my latin english :-) P.S.1 I don't understand why wrapping 456-123 on the hyphen in the arabic text behaves different from wrapping 123-456 in the hebrew text. On both 456 goes on new line and 123 stays over! Why?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads