[FriBidi-commit] fribidi/lib fribidi-bidi.c, 1.15,
1.16 fribidi-bidi.h, 1.11, 1.12 fribidi.c, 1.12, 1.13
Behdad Esfahbod
behdad at pdx.freedesktop.org
Mon Jun 21 09:15:31 PDT 2004
- Previous message: [FriBidi-commit] fribidi/test Makefile.am, 1.1.1.1,
1.2 test_CapRTL_explicit.input, 1.1.1.1,
1.2 test_CapRTL_explicit.reference, 1.1.1.1, 1.2
- Next message: [FriBidi-commit] fribidi/lib bidi-types.h, 1.5, 1.6 common.h, 1.14,
1.15 fribidi-bidi-types.h, 1.12, 1.13 fribidi-bidi.c, 1.16,
1.17 fribidi-bidi.h, 1.12, 1.13 fribidi-joining.c, 1.2,
1.3 fribidi-run.c, 1.5, 1.6 fribidi-unicode.h, 1.3,
1.4 fribidi.c, 1.13, 1.14 run.h, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/fribidi/fribidi/lib
In directory pdx:/tmp/cvs-serv2148/lib
Modified Files:
fribidi-bidi.c fribidi-bidi.h fribidi.c
Log Message:
Fixed a bug in fribidi_log2vis(), also changed fribidi_reorder_line() api to
allow not passing visual_str, by passing str instead.
Index: fribidi-bidi.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- fribidi-bidi.c 18 Jun 2004 22:41:39 -0000 1.15
+++ fribidi-bidi.c 21 Jun 2004 16:15:27 -0000 1.16
@@ -757,11 +757,11 @@
register FriBidiRun *p, *q, *list;
/* L1. Reset the embedding levels of some chars:
- 1. segment separators,
- 2. paragraph separators,
- 3. any sequence of whitespace characters preceding a segment
- separator or paragraph separator, and
- ... (to be continued in fribidi_reorder_line()). */
+ 1. segment separators,
+ 2. paragraph separators,
+ 3. any sequence of whitespace characters preceding a segment
+ separator or paragraph separator, and
+ ... (to be continued in fribidi_reorder_line()). */
list = new_run_list ();
if UNLIKELY
(!list) goto out;
@@ -877,8 +877,7 @@
FRIBIDI_ENTRY FriBidiLevel
fribidi_reorder_line (
- /* input and output */
- FriBidiChar *str,
+ const FriBidiChar *str,
/* input */
const FriBidiStrIndex len,
const FriBidiStrIndex off,
@@ -886,6 +885,7 @@
const FriBidiParType base_dir,
/* input and output */
FriBidiLevel *embedding_levels,
+ FriBidiChar *visual_str,
/* output */
FriBidiStrIndex *positions_L_to_V,
FriBidiStrIndex *positions_V_to_L
@@ -915,17 +915,20 @@
DBG ("in fribidi_reorder_line");
- fribidi_assert (str || bidi_types);
+ fribidi_assert (str || visual_str || bidi_types);
fribidi_assert (embedding_levels);
+ if (!str)
+ str = visual_str;
+
DBG ("reset the embedding levels, 4. whitespace at the end of line");
{
register FriBidiStrIndex i;
/* L1. Reset the embedding levels of some chars:
- 4. any sequence of white space characters at the end of the line.*/
+ 4. any sequence of white space characters at the end of the line. */
for (i = off + len - 1; i >= off &&
- FRIBIDI_IS_EXPLICIT_OR_BN_OR_WS (BIDI_TYPE (i)); i--)
+ FRIBIDI_IS_EXPLICIT_OR_BN_OR_WS (BIDI_TYPE (i)); i--)
embedding_levels[i] = FRIBIDI_DIR_TO_LEVEL (base_dir);
}
@@ -975,9 +978,9 @@
DBG ("warning: NSM(s) at the beggining of level run");
}
- if (str)
+ if (visual_str)
{
- bidi_string_reverse (str + i, seq_end - i + 1);
+ bidi_string_reverse (visual_str + i, seq_end - i + 1);
}
if (positions_V_to_L)
{
@@ -1004,8 +1007,8 @@
for (i--; i >= off && embedding_levels[i] >= level; i--)
;
- if (str)
- bidi_string_reverse (str + i + 1, seq_end - i);
+ if (visual_str)
+ bidi_string_reverse (visual_str + i + 1, seq_end - i);
if (positions_V_to_L)
index_array_reverse (positions_V_to_L + i + 1, seq_end - i);
}
Index: fribidi-bidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fribidi-bidi.h 18 Jun 2004 19:21:33 -0000 1.11
+++ fribidi-bidi.h 21 Jun 2004 16:15:27 -0000 1.12
@@ -116,12 +116,19 @@
*
* As a side effect it also sets position maps if not NULL.
*
- * You can provide either the string, or the bidi types; or both. If
+ * You can provide either the string str, or the bidi types; or both. If
* bidi_types are provided, they are used as the bidi types of characters in
* the string, otherwise the types are computed from the characters in str.
+ * If neither str nor bidi types are provided, visual_str is used instead.
+ * Feel free to pass the same string as both str and visual_str, but if you
+ * done extensive complicated shaping in visual_str, you better provide
+ * logical string as str. There is no known differences yet between providing
+ * logical or visual string as str.
+ *
* If you have obtained the embedding levels using custom bidi types, you
* should provide the same types to this function for valid resutls.
- * Providing bidi types if available at your side, saves you a few cycles.
+ * Providing bidi types if available at your side, saves you a few cycles, and
+ * you don't need to provide str anymore.
*
* You should provide the resolved paragraph direction and embedding levels as
* set by fribidi_get_par_embedding_levels(). Also note that the embedding
@@ -139,15 +146,16 @@
* occured (memory allocation failure most probably).
*/
FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line (
- FriBidiChar *str, /* string to reorder */
+ const FriBidiChar *str, /* input string */
const FriBidiStrIndex len, /* input length of the line */
const FriBidiStrIndex off, /* input offset of the beginning of the line
in the paragraph */
const FriBidiCharType *bidi_types, /* input bidi types */
const FriBidiParType base_dir, /* resolved paragraph base direction */
- FriBidiLevel *embedding_levels, /* input list of embedding levels,
+ FriBidiLevel *embedding_levels, /* list of embedding levels,
as returned by
fribidi_get_par_embedding_levels */
+ FriBidiChar *visual_str, /* visual string to reorder */
FriBidiStrIndex *positions_L_to_V, /* output mapping from logical to
visual string positions */
FriBidiStrIndex *positions_V_to_L /* output mapping from visual string
Index: fribidi.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- fribidi.c 18 Jun 2004 19:21:33 -0000 1.12
+++ fribidi.c 21 Jun 2004 16:15:27 -0000 1.13
@@ -172,15 +172,23 @@
if UNLIKELY
(max_level < 0) goto out;
+ if (visual_str)
+ {
+ register FriBidiStrIndex i;
+
+ for (i = len - 1; i >= 0; i--)
+ visual_str[i] = str[i];
+
#if !FRIBIDI_NO_ARABIC
- /* Arabic joining */
- {
- ar_props = fribidi_malloc (len * sizeof ar_props[0]);
- fribidi_get_joining_types (str, len, ar_props);
- fribidi_join_arabic (embedding_levels, len, ar_props);
- }
+ /* Arabic joining */
+ ar_props = fribidi_malloc (len * sizeof ar_props[0]);
+ fribidi_get_joining_types (str, len, ar_props);
+ fribidi_join_arabic (embedding_levels, len, ar_props);
#endif /* !FRIBIDI_NO_ARABIC */
+ fribidi_shape (embedding_levels, len, visual_str);
+ }
+
/* If l2v is to be calculated we must have v2l as well. If it is not
given by the caller, we have to make a private instance of it. */
if (positions_L_to_V && !positions_V_to_L)
@@ -192,17 +200,10 @@
private_V_to_L = true;
}
- if (visual_str)
- {
- register FriBidiStrIndex i;
-
- for (i = len; i >= 0; i--)
- visual_str[i] = str[i];
- }
-
- fribidi_shape (embedding_levels, len, visual_str);
-
- status = fribidi_reorder_line (visual_str, len, 0, NULL, *pbase_dir, embedding_levels, positions_L_to_V, positions_V_to_L);
+ status =
+ fribidi_reorder_line (str, len, 0, NULL, *pbase_dir,
+ embedding_levels, visual_str,
+ positions_L_to_V, positions_V_to_L);
out:
- Previous message: [FriBidi-commit] fribidi/test Makefile.am, 1.1.1.1,
1.2 test_CapRTL_explicit.input, 1.1.1.1,
1.2 test_CapRTL_explicit.reference, 1.1.1.1, 1.2
- Next message: [FriBidi-commit] fribidi/lib bidi-types.h, 1.5, 1.6 common.h, 1.14,
1.15 fribidi-bidi-types.h, 1.12, 1.13 fribidi-bidi.c, 1.16,
1.17 fribidi-bidi.h, 1.12, 1.13 fribidi-joining.c, 1.2,
1.3 fribidi-run.c, 1.5, 1.6 fribidi-unicode.h, 1.3,
1.4 fribidi.c, 1.13, 1.14 run.h, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the FriBidi-Commit
mailing list