]> granicus.if.org Git - fribidi/commitdiff
We need bidi_types all over the place (in joining, in shaping, ...), so
authorbehdad <behdad>
Mon, 21 Jun 2004 18:49:23 +0000 (18:49 +0000)
committerbehdad <behdad>
Mon, 21 Jun 2004 18:49:23 +0000 (18:49 +0000)
make them mandatory.  As a consequence, many of our functions don't need str
anymore:  they just need this bidi_types.

lib/bidi-types.h
lib/common.h
lib/fribidi-bidi-types.h
lib/fribidi-bidi.c
lib/fribidi-bidi.h
lib/fribidi-joining.c
lib/fribidi-run.c
lib/fribidi-unicode.h
lib/fribidi.c
lib/run.h

index 3ae213ea99b59ba476cceef89904b6bb1dc0d82d..a8f9d973ba86c3fd0ae984481ce7f7d7b0fee53a 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * bidi-types.h - define internal bidi types
  *
- * $Id: bidi-types.h,v 1.5 2004-06-14 17:00:33 behdad Exp $
+ * $Id: bidi-types.h,v 1.6 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-14 17:00:33 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.6 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/bidi-types.h,v $
  *
  * Author:
@@ -53,8 +53,6 @@ fribidi_char_from_bidi_type (
 
 #endif /* DEBUG */
 
-#define BIDI_TYPE(i) (bidi_types ? bidi_types[(i)] : fribidi_get_bidi_type(str[(i)]))
-
 #include <fribidi-enddecls.h>
 
 #endif /* !_BIDI_TYPES_H */
index 4e1bd09d1409609a3196cfe1c2e73ae62d8d36f5..31f5a01ff59df99aae4bd507039e162fd3e38ac5 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * common.h - common include for library sources
  *
- * $Id: common.h,v 1.14 2004-06-15 11:52:02 behdad Exp $
+ * $Id: common.h,v 1.15 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-15 11:52:02 $
- * $Revision: 1.14 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.15 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/common.h,v $
  *
  * Author:
 # define _GNU_SOURCE
 #endif /* !_GNU_SOURCE */
 
+/* We respect our own rules. */
+#define FRIBIDI_STRICT 1
+#undef FRIBIDI_COMPAT
+
+
 #include "debug.h"
 
 #endif /* !_COMMON_H */
index 5fc0c77066c2a9303a8964e78c7ae639da356478..3c4bb97f5f4bf97b38af472e5c525f516ec0106a 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi-types.h - character bidi types
  *
- * $Id: fribidi-bidi-types.h,v 1.12 2004-06-18 19:21:33 behdad Exp $
+ * $Id: fribidi-bidi-types.h,v 1.13 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-18 19:21:33 $
- * $Revision: 1.12 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.13 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $
  *
  * Author:
@@ -224,16 +224,20 @@ typedef fribidi_uint32 FriBidiParType;
 
 #endif
 
-/* For lazy people... */
+/* Please don't use these two type names, use FRIBIDI_PAR_* form instead. */
 #define FRIBIDI_TYPE_WLTR      FRIBIDI_PAR_WLTR
-#define FRIBIDI_TYPE_WL                FRIBIDI_PAR_WLTR
 #define FRIBIDI_TYPE_WRTL      FRIBIDI_PAR_WRTL
+
+/* These are here just for lazy people. */
+#if !FRIBIDI_STRICT
+#define FRIBIDI_TYPE_WL                FRIBIDI_PAR_WLTR
 #define FRIBIDI_TYPE_WR                FRIBIDI_PAR_WRTL
 #define FRIBIDI_TYPE_L         FRIBIDI_PAR_LTR
 #define FRIBIDI_TYPE_R         FRIBIDI_PAR_RTL
 #define FRIBIDI_TYPE_N         FRIBIDI_PAR_ON
 #define FRIBIDI_TYPE_B         FRIBIDI_TYPE_BS
 #define FRIBIDI_TYPE_S         FRIBIDI_TYPE_SS
+#endif /* !FRIBIDI_STRICT */
 
 
 /*
index e2ca7396912ca6919cffb3e6f2cfa876cdfbd6dc..ff760e514e0fe746fd14e723f52b0c31bdb2b965 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi.c - bidirectional algorithm
  *
- * $Id: fribidi-bidi.c,v 1.16 2004-06-21 16:15:27 behdad Exp $
+ * $Id: fribidi-bidi.c,v 1.17 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-21 16:15:27 $
- * $Revision: 1.16 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.17 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.c,v $
  *
  * Authors:
@@ -198,18 +198,17 @@ print_resolved_types (
 static void
 print_bidi_string (
   /* input */
-  const FriBidiChar *str,
-  const FriBidiStrIndex len,
-  const FriBidiCharType *bidi_types
+  const FriBidiCharType *bidi_types,
+  const FriBidiStrIndex len
 )
 {
   register FriBidiStrIndex i;
 
-  fribidi_assert (str || bidi_types);
+  fribidi_assert (bidi_types);
 
   MSG ("  Org. types : ");
   for (i = 0; i < len; i++)
-    MSG2 ("%c", fribidi_char_from_bidi_type (BIDI_TYPE (i)));
+    MSG2 ("%c", fribidi_char_from_bidi_type (bidi_types[i]));
   MSG ("\n");
 }
 #endif /* DEBUG */
@@ -308,18 +307,17 @@ print_bidi_string (
 FRIBIDI_ENTRY FriBidiParType
 fribidi_get_par_direction (
   /* input */
-  const FriBidiChar *str,
-  const FriBidiStrIndex len,
-  const FriBidiCharType *bidi_types
+  const FriBidiCharType *bidi_types,
+  const FriBidiStrIndex len
 )
 {
   register FriBidiStrIndex i;
 
-  fribidi_assert (str || bidi_types);
+  fribidi_assert (bidi_types);
 
   for (i = 0; i < len; i++)
-    if (FRIBIDI_IS_LETTER (BIDI_TYPE (i)))
-      return FRIBIDI_IS_RTL (BIDI_TYPE (i)) ? FRIBIDI_PAR_RTL :
+    if (FRIBIDI_IS_LETTER (bidi_types[i]))
+      return FRIBIDI_IS_RTL (bidi_types[i]) ? FRIBIDI_PAR_RTL :
        FRIBIDI_PAR_LTR;
 
   return FRIBIDI_PAR_ON;
@@ -328,9 +326,8 @@ fribidi_get_par_direction (
 FRIBIDI_ENTRY FriBidiLevel
 fribidi_get_par_embedding_levels (
   /* input */
-  const FriBidiChar *str,
-  const FriBidiStrIndex len,
   const FriBidiCharType *bidi_types,
+  const FriBidiStrIndex len,
   /* input and output */
   FriBidiParType *pbase_dir,
   /* output */
@@ -349,16 +346,16 @@ fribidi_get_par_embedding_levels (
       goto out;
     }
 
-  DBG ("entering fribidi_get_par_embedding_levels");
+  DBG ("in fribidi_get_par_embedding_levels");
 
-  fribidi_assert (str || bidi_types);
+  fribidi_assert (bidi_types);
   fribidi_assert (pbase_dir);
   fribidi_assert (embedding_levels);
 
   /* Determinate character types */
   {
     /* Get run-length encoded character types */
-    main_run_list = run_list_encode_bidi_types (str, len, bidi_types);
+    main_run_list = run_list_encode_bidi_types (bidi_types, len);
     if UNLIKELY
       (!main_run_list) goto out;
   }
@@ -512,7 +509,7 @@ fribidi_get_par_embedding_levels (
     (fribidi_debug_status ())
     {
       print_types_re (main_run_list);
-      print_bidi_string (str, len, bidi_types);
+      print_bidi_string (bidi_types, len);
       print_resolved_levels (main_run_list);
       print_resolved_types (main_run_list);
     }
@@ -716,7 +713,7 @@ fribidi_get_par_embedding_levels (
   if UNLIKELY
     (fribidi_debug_status ())
     {
-      print_bidi_string (str, len, bidi_types);
+      print_bidi_string (bidi_types, len);
       print_resolved_levels (main_run_list);
       print_resolved_types (main_run_list);
     }
@@ -772,7 +769,7 @@ fribidi_get_par_embedding_levels (
       {
        /* close up the open link at the end */
        if (j >= 0)
-         char_type = BIDI_TYPE (j);
+         char_type = bidi_types[j];
        else
          char_type = FRIBIDI_TYPE_ON;
        if (!state && FRIBIDI_IS_SEPARATOR (char_type))
@@ -877,11 +874,10 @@ index_array_reverse (
 
 FRIBIDI_ENTRY FriBidiLevel
 fribidi_reorder_line (
-  const FriBidiChar *str,
   /* input */
+  const FriBidiCharType *bidi_types,
   const FriBidiStrIndex len,
   const FriBidiStrIndex off,
-  const FriBidiCharType *bidi_types,
   const FriBidiParType base_dir,
   /* input and output */
   FriBidiLevel *embedding_levels,
@@ -915,12 +911,9 @@ fribidi_reorder_line (
 
   DBG ("in fribidi_reorder_line");
 
-  fribidi_assert (str || visual_str || bidi_types);
+  fribidi_assert (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;
@@ -928,7 +921,7 @@ fribidi_reorder_line (
     /* L1. Reset the embedding levels of some chars:
        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_types[i]); i--)
       embedding_levels[i] = FRIBIDI_DIR_TO_LEVEL (base_dir);
   }
 
@@ -962,13 +955,13 @@ fribidi_reorder_line (
          /* L3. Reorder NSMs. */
          for (i = off + len - 1; i >= off; i--)
            if (FRIBIDI_LEVEL_IS_RTL (embedding_levels[i])
-               && BIDI_TYPE (i) == FRIBIDI_TYPE_NSM)
+               && bidi_types[i] == FRIBIDI_TYPE_NSM)
              {
                register FriBidiStrIndex seq_end = i;
                level = embedding_levels[i];
 
                for (i--; i >= off &&
-                    FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM (BIDI_TYPE (i))
+                    FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM (bidi_types[i])
                     && embedding_levels[i] == level; i--)
                  ;
 
index 90f0763977cda477953fa7c9c29c5725fa178e1c..99596bd840a0b6b292fa66bd4f9090d4b5d0cce9 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi.h - bidirectional algorithm
  *
- * $Id: fribidi-bidi.h,v 1.12 2004-06-21 16:15:27 behdad Exp $
+ * $Id: fribidi-bidi.h,v 1.13 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-21 16:15:27 $
- * $Revision: 1.12 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.13 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.h,v $
  *
  * Authors:
  * as defined by rule P2 of the Unicode Bidirectional Algorithm available at
  * http://www.unicode.org/reports/tr9/#P2.
  *
- * You can provide either the string, 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.
- * Providing bidi types if available at your side, saves you a few cycles.
- * Bidi types can be obtained by calling fribidi_get_bidi_types().
- *
  * You typically do not need this function as
  * fribidi_get_par_embedding_levels() knows how to compute base direction
  * itself, but you may need this to implement a more sophisticated paragraph
@@ -69,9 +63,8 @@
  * only LTR, RTL, or ON.
  */
 FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction (
-  const FriBidiChar *str,      /* input paragraph string */
-  const FriBidiStrIndex len,   /* input string length */
-  const FriBidiCharType *bidi_types    /* input bidi types */
+  const FriBidiCharType *bidi_types,   /* input bidi types */
+  const FriBidiStrIndex len    /* input string length */
 );
 
 #define fribidi_get_par_embedding_levels FRIBIDI_NAMESPACE(get_par_embedding_levels)
@@ -84,12 +77,6 @@ FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction (
  *  implemented in fribidi_remove_bidi_marks().  Part 4 of L1 is implemented
  *  in fribidi_reorder_line().
  *
- * You can provide either the string, 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.
- * Providing bidi types if available at your side, saves you a few cycles.
- * Bidi types can be obtained by calling fribidi_get_bidi_types().
- *
  * There are a few macros defined in fribidi-bidi-types.h to work with this
  * embedding levels.
  *
@@ -98,9 +85,8 @@ FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction (
  */
 FRIBIDI_ENTRY FriBidiLevel
 fribidi_get_par_embedding_levels (
-  const FriBidiChar *str,      /* input paragraph string */
-  const FriBidiStrIndex len,   /* input string length of the paragraph */
   const FriBidiCharType *bidi_types,   /* input bidi types */
+  const FriBidiStrIndex len,   /* input string length of the paragraph */
   FriBidiParType *pbase_dir,   /* requested and resolved paragraph
                                 * base direction */
   FriBidiLevel *embedding_levels       /* output list of embedding levels */
@@ -116,20 +102,6 @@ fribidi_get_par_embedding_levels (
  *
  * As a side effect it also sets position maps if not NULL.
  *
- * 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, 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
  * levels may change a bit.  To be exact, the embedding level of any sequence
@@ -146,11 +118,10 @@ fribidi_get_par_embedding_levels (
  * occured (memory allocation failure most probably).
  */
      FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line (
-  const FriBidiChar *str,      /* input string */
+  const FriBidiCharType *bidi_types,   /* input bidi types */
   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,      /* list of embedding levels,
                                           as returned by
index 0673c5281cf5ed24a2f78c67cb4aa4da29a85621..fea9ba820e59102c9c6bf9deff3c97d36302b8c0 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-joining.h - Arabic joining algorithm
  *
- * $Id: fribidi-joining.c,v 1.2 2004-06-15 11:52:02 behdad Exp $
+ * $Id: fribidi-joining.c,v 1.3 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-15 11:52:02 $
- * $Revision: 1.2 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.3 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining.c,v $
  *
  * Authors:
@@ -70,6 +70,15 @@ print_joining_types (
 #endif /* DEBUG */
 
 
+#if FRIBIDI_JOIN_WITHIN_RUN_LEVEL
+/* Join within same level run (to be proposed for inclusion in Unicode 4.1) */
+# define FRIBIDI_JOINING_RUN(l) (l)
+#else /* !FRIBIDI_JOIN_WITHIN_RUN_LEVEL */
+/* Join within same directional run (current rule in Unicode 4.0.1) */
+# define FRIBIDI_JOINING_RUN(l) FRIBIDI_LEVEL_IS_RTL(l)
+#endif /* !FRIBIDI_JOIN_WITHIN_RUN_LEVEL */
+
+
 FRIBIDI_ENTRY void
 fribidi_join_arabic (
   /* input */
@@ -82,7 +91,7 @@ fribidi_join_arabic (
   if UNLIKELY
     (len == 0) return;
 
-  DBG ("entering fribidi_join_arabic");
+  DBG ("in fribidi_join_arabic");
 
   fribidi_assert (embedding_levels);
   fribidi_assert (ar_props);
index be8a66b75569fcc3657c7d9cf607b064b487120b..bfa47f15f37023308f7dec6a17ef2e7f7cd3c575 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-run.c - text run data type
  *
- * $Id: fribidi-run.c,v 1.5 2004-06-14 18:43:53 behdad Exp $
+ * $Id: fribidi-run.c,v 1.6 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-14 18:43:53 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.6 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-run.c,v $
  *
  * Authors:
@@ -156,16 +156,15 @@ free_run_list (
 FriBidiRun *
 run_list_encode_bidi_types (
   /* input */
-  const FriBidiChar *str,
-  const FriBidiStrIndex len,
-  const FriBidiCharType *bidi_types
+  const FriBidiCharType *bidi_types,
+  const FriBidiStrIndex len
 )
 {
   FriBidiRun *list, *last;
   register FriBidiRun *run = NULL;
   FriBidiStrIndex i;
 
-  fribidi_assert (str || bidi_types);
+  fribidi_assert (bidi_types);
 
   /* Create the list sentinel */
   list = new_run_list ();
@@ -176,7 +175,7 @@ run_list_encode_bidi_types (
   /* Scan over the character types */
   for (i = 0; i < len; i++)
     {
-      register FriBidiCharType char_type = BIDI_TYPE (i);
+      register FriBidiCharType char_type = bidi_types[i];
       if (char_type != last->type)
        {
          run = new_run ();
index 2a497ee7b779ee31be6a506745711b8a642a1fcf..e77da2e90fcf1a665434619792a1e6abbefee01c 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-unicode.h - general Unicode definitions
  *
- * $Id: fribidi-unicode.h,v 1.3 2004-05-12 08:17:19 behdad Exp $
+ * $Id: fribidi-unicode.h,v 1.4 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-05-12 08:17:19 $
- * $Revision: 1.3 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.4 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-unicode.h,v $
  *
  * Author:
@@ -55,7 +55,7 @@
 extern const char *fribidi_unicode_version;
 
 
-/* The Unicode Bidirectional Algorithm constants */
+/* Unicode Bidirectional Algorithm definitions: */
 
 /* Number of types defined in the bidi algorithm */
 #define FRIBIDI_BIDI_NUM_TYPES                 19
@@ -66,6 +66,12 @@ extern const char *fribidi_unicode_version;
 #define FRIBIDI_BIDI_MAX_RESOLVED_LEVELS       63
 
 
+/* Unicode Arabic joining/shaping definitions: */
+
+/* Unicode 4.0.1: join within "directional run", not "level run". */
+#undef FRIBIDI_JOIN_WITHIN_RUN_LEVEL
+
+
 /* A few Unicode characters */
 
 /* Bidirectional marks */
@@ -91,7 +97,8 @@ extern const char *fribidi_unicode_version;
 #define FRIBIDI_CHAR_ARABIC_ZERO       0x0660
 #define FRIBIDI_CHAR_PERSIAN_ZERO      0x06F0
 
-/* These are here just for compatibility. */
+/* These are here just for lazy people. */
+#if !FRIBIDI_STRICT
 #define UNI_MAX_BIDI_LEVEL     FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL
 #define UNI_LRM                        FRIBIDI_CHAR_LRM
 #define UNI_RLM                        FRIBIDI_CHAR_RLM
@@ -107,6 +114,7 @@ extern const char *fribidi_unicode_version;
 #define UNI_ARABIC_ALEF                FRIBIDI_CHAR_ARABIC_ALEF
 #define UNI_ARABIC_ZERO                FRIBIDI_CHAR_ARABIC_ZERO
 #define UNI_FARSI_ZERO         FRIBIDI_CHAR_PERSIAN_ZERO
+#endif /* !FRIBIDI_STRICT */
 
 #include "fribidi-enddecls.h"
 
index 7ed00936855dca68d7e745c20a2ba6f125d52637..4b92dcad6f2f4f8300bf27b3758f7ae6ec3ff6b8 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi.c - Unicode bidirectional and Arabic joining/shaping algorithms
  *
- * $Id: fribidi.c,v 1.13 2004-06-21 16:15:27 behdad Exp $
+ * $Id: fribidi.c,v 1.14 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-21 16:15:27 $
- * $Revision: 1.13 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.14 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.c,v $
  *
  * Authors:
@@ -146,6 +146,7 @@ fribidi_log2vis (
   fribidi_boolean private_embedding_levels = false;
   fribidi_boolean status = false;
   FriBidiArabicProps *ar_props = NULL;
+  FriBidiCharType *bidi_types = NULL;
 
   if UNLIKELY
     (len == 0)
@@ -159,6 +160,12 @@ fribidi_log2vis (
   fribidi_assert (str);
   fribidi_assert (pbase_dir);
 
+  bidi_types = fribidi_malloc (len * sizeof bidi_types[0]);
+  if (!bidi_types)
+    goto out;
+
+  fribidi_get_bidi_types (str, len, bidi_types);
+
   if (!embedding_levels)
     {
       embedding_levels = fribidi_malloc (len * sizeof embedding_levels[0]);
@@ -167,7 +174,7 @@ fribidi_log2vis (
       private_embedding_levels = true;
     }
 
-  max_level = fribidi_get_par_embedding_levels (str, len, NULL, pbase_dir,
+  max_level = fribidi_get_par_embedding_levels (bidi_types, len, pbase_dir,
                                                embedding_levels) - 1;
   if UNLIKELY
     (max_level < 0) goto out;
@@ -201,7 +208,7 @@ fribidi_log2vis (
     }
 
   status =
-    fribidi_reorder_line (str, len, 0, NULL, *pbase_dir,
+    fribidi_reorder_line (bidi_types, len, 0, *pbase_dir,
                          embedding_levels, visual_str,
                          positions_L_to_V, positions_V_to_L);
 
@@ -216,6 +223,9 @@ out:
   if (ar_props)
     fribidi_free (ar_props);
 
+  if (bidi_types)
+    fribidi_free (bidi_types);
+
   return status ? max_level + 1 : 0;
 }
 
index d284d1dbd91afec889499149fe142a0cab56ac02..ef6aca02fd7022d684668652c1a0033c3eb4aca7 100644 (file)
--- a/lib/run.h
+++ b/lib/run.h
@@ -1,10 +1,10 @@
 /* FriBidi
  * run.h - text run data type
  *
- * $Id: run.h,v 1.6 2004-06-14 17:00:33 behdad Exp $
+ * $Id: run.h,v 1.7 2004-06-21 18:49:23 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-14 17:00:33 $
- * $Revision: 1.6 $
+ * $Date: 2004-06-21 18:49:23 $
+ * $Revision: 1.7 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/run.h,v $
  *
  * Authors:
@@ -82,9 +82,8 @@ new_run (
 
 #define run_list_encode_bidi_types FRIBIDI_PRIVATESPACE(run_list_encode_bidi_types)
      FriBidiRun *run_list_encode_bidi_types (
-  const FriBidiChar *str,
-  const FriBidiStrIndex len,
-  const FriBidiCharType *bidi_types
+  const FriBidiCharType *bidi_types,
+  const FriBidiStrIndex len
 )
      FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;