[FriBidi-commit] fribidi/lib fribidi-bidi-types-list.h, 1.2, 1.3 fribidi-bidi-types.h, 1.4, 1.5 fribidi-bidi.c, 1.9, 1.10 fribidi-bidi.h, 1.5, 1.6 fribidi-mirroring.c, 1.7, 1.8 fribidi-mirroring.h, 1.5, 1.6 fribidi.c, 1.6, 1.7 fribidi.def, 1.2, 1.3 fribidi.h, 1.1.1.1, 1.2

Behdad Esfahbod behdad at pdx.freedesktop.org
Mon Jun 7 13:38:23 PDT 2004


Update of /cvs/fribidi/fribidi/lib
In directory pdx:/tmp/cvs-serv27593/lib

Modified Files:
	fribidi-bidi-types-list.h fribidi-bidi-types.h fribidi-bidi.c 
	fribidi-bidi.h fribidi-mirroring.c fribidi-mirroring.h 
	fribidi.c fribidi.def fribidi.h 
Log Message:
Finally done with the clean API for bidi functionality.  The API is not final
yet, but does the job.  Also define FriBidiCharType as an enum if possible.
Added type FriBidiParType for paragraph direction types.


Index: fribidi-bidi-types-list.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types-list.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fribidi-bidi-types-list.h	4 Jun 2004 09:41:11 -0000	1.2
+++ b/fribidi-bidi-types-list.h	7 Jun 2004 20:38:21 -0000	1.3
@@ -41,8 +41,7 @@
 #endif
 
 #if !defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES)
-/* Bidi types from the standard. */
-/* The order of these types is important.  Don't change. */
+
 _FRIBIDI_ADD_TYPE (LTR, 'L')	/* Left-To-Right letter */
 _FRIBIDI_ADD_TYPE (RTL, 'R')	/* Right-To-Left letter */
 _FRIBIDI_ADD_TYPE (AL, 'A')	/* Arabic Letter */
@@ -64,8 +63,6 @@
 _FRIBIDI_ADD_TYPE (PDF, '-')	/* Pop Directional Flag */
 
 #if defined(_FRIBIDI_ADD_ALIAS)
-/* The followings are just aliases to types, but with the name that appears in
- * the Unicode database. */
 _FRIBIDI_ADD_ALIAS (L, LTR)
 _FRIBIDI_ADD_ALIAS (R, RTL)
 _FRIBIDI_ADD_ALIAS (B, BS)

Index: fribidi-bidi-types.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/fribidi-bidi-types.h	4 Jun 2004 09:41:11 -0000	1.4
+++ b/fribidi-bidi-types.h	7 Jun 2004 20:38:21 -0000	1.5
@@ -43,9 +43,6 @@
 
 typedef struct _FriBidiRun FriBidiRun;
 
-typedef fribidi_uint32 FriBidiMaskType;
-typedef FriBidiMaskType FriBidiCharType;
-
 /* 
  * Define some bit masks, that character types are based on, each one has
  * only one bit on.
@@ -98,84 +95,138 @@
  */
 
 /* Strong left to right */
-#define FRIBIDI_TYPE_LTR	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER )
+#define FRIBIDI_TYPE_LTR_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER )
 /* Right to left characters */
-#define FRIBIDI_TYPE_RTL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
+#define FRIBIDI_TYPE_RTL_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
 				+ FRIBIDI_MASK_RTL)
 /* Arabic characters */
-#define FRIBIDI_TYPE_AL		( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
+#define FRIBIDI_TYPE_AL_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
 				+ FRIBIDI_MASK_RTL + FRIBIDI_MASK_ARABIC )
 /* Left-To-Right embedding */
-#define FRIBIDI_TYPE_LRE	(FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT)
+#define FRIBIDI_TYPE_LRE_VAL	(FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT)
 /* Right-To-Left embedding */
-#define FRIBIDI_TYPE_RLE	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
+#define FRIBIDI_TYPE_RLE_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
 				+ FRIBIDI_MASK_RTL )
 /* Left-To-Right override */
-#define FRIBIDI_TYPE_LRO	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
+#define FRIBIDI_TYPE_LRO_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
 				+ FRIBIDI_MASK_OVERRIDE )
 /* Right-To-Left override */
-#define FRIBIDI_TYPE_RLO	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
+#define FRIBIDI_TYPE_RLO_VAL	( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
 				+ FRIBIDI_MASK_RTL + FRIBIDI_MASK_OVERRIDE )
 
 /* Pop directional override */
-#define FRIBIDI_TYPE_PDF	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_EXPLICIT )
+#define FRIBIDI_TYPE_PDF_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_EXPLICIT )
 /* European digit */
-#define FRIBIDI_TYPE_EN		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER )
+#define FRIBIDI_TYPE_EN_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER )
 /* Arabic digit */
-#define FRIBIDI_TYPE_AN		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER \
+#define FRIBIDI_TYPE_AN_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER \
 				+ FRIBIDI_MASK_ARABIC )
 /* European number separator */
-#define FRIBIDI_TYPE_ES		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
+#define FRIBIDI_TYPE_ES_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
 				+ FRIBIDI_MASK_ES )
 /* European number terminator */
-#define FRIBIDI_TYPE_ET		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
+#define FRIBIDI_TYPE_ET_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
 				+ FRIBIDI_MASK_ET )
 /* Common Separator */
-#define FRIBIDI_TYPE_CS		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
+#define FRIBIDI_TYPE_CS_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
 				+ FRIBIDI_MASK_CS )
 /* Non spacing mark */
-#define FRIBIDI_TYPE_NSM	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NSM )
+#define FRIBIDI_TYPE_NSM_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NSM )
 /* Boundary neutral */
-#define FRIBIDI_TYPE_BN		( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_SPACE \
+#define FRIBIDI_TYPE_BN_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_SPACE \
 				+ FRIBIDI_MASK_BN )
 
 /* Block separator */
-#define FRIBIDI_TYPE_BS		( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
+#define FRIBIDI_TYPE_BS_VAL	( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
 				+ FRIBIDI_MASK_SEPARATOR + FRIBIDI_MASK_BS )
 /* Segment separator */
-#define FRIBIDI_TYPE_SS		( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
+#define FRIBIDI_TYPE_SS_VAL	( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
 				+ FRIBIDI_MASK_SEPARATOR + FRIBIDI_MASK_SS )
 /* Whitespace */
-#define FRIBIDI_TYPE_WS		( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
+#define FRIBIDI_TYPE_WS_VAL	( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
 				+ FRIBIDI_MASK_WS )
 /* Other Neutral */
-#define FRIBIDI_TYPE_ON		( FRIBIDI_MASK_NEUTRAL )
+#define FRIBIDI_TYPE_ON_VAL	( FRIBIDI_MASK_NEUTRAL )
 
 
-/* The following are used in specifying paragraph direction only, not real
- * types. */
+/* The following are used in specifying paragraph direction only. */
 
 /* Weak left to right */
-#define FRIBIDI_TYPE_WLTR	( FRIBIDI_MASK_WEAK )
+#define FRIBIDI_TYPE_WLTR_VAL	( FRIBIDI_MASK_WEAK )
 /* Weak right to left */
-#define FRIBIDI_TYPE_WRTL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_RTL )
-
-
-/* Just for compatibility */
-#define FRIBIDI_TYPE_WL		FRIBIDI_TYPE_WLTR
-#define FRIBIDI_TYPE_WR		FRIBIDI_TYPE_WRTL
-#define FRIBIDI_TYPE_L		FRIBIDI_TYPE_LTR
-#define FRIBIDI_TYPE_R		FRIBIDI_TYPE_RTL
-#define FRIBIDI_TYPE_N		FRIBIDI_TYPE_ON
+#define FRIBIDI_TYPE_WRTL_VAL	( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_RTL )
 
 /* The following is only used internally */
 
 /* Start or end of text (run list) */
 #define FRIBIDI_TYPE_SENTINEL	( FRIBIDI_MASK_SENTINEL )
 
-/*
- * End of define values for FriBidiCharType
- */
+/* Define values for FriBidiCharType. */
+
+#if defined(__C2MAN__) || (defined(FRIBIDI_SIZEOF_INT) && ((FRIBIDI_SIZEOF_INT <= 4) && (FRIBIDI_SIZEOF_INT >= 4)))
+
+typedef enum
+{
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
+	FRIBIDI_TYPE_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
+# include "fribidi-bidi-types-list.h"
+# undef _FRIBIDI_ADD_TYPE
+  _FRIBIDI_TYPE_JUNK
+} FriBidiCharType;
+
+typedef enum
+{
+# define _FRIBIDI_PAR_TYPES
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
+	FRIBIDI_PAR_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
+# include "fribidi-bidi-types-list.h"
+# undef _FRIBIDI_ADD_TYPE
+# undef _FRIBIDI_PAR_TYPES
+  _FRIBIDI_TYPE_JUNK
+} FriBidiParType;
+
+#else
+
+typedef fribidi_uint32 FriBidiCharType;
+# define FRIBIDI_TYPE_LTR	FRIBIDI_TYPE_LTR_VAL
+# define FRIBIDI_TYPE_RTL	FRIBIDI_TYPE_RTL_VAL
+# define FRIBIDI_TYPE_AL	FRIBIDI_TYPE_AL_VAL
+# define FRIBIDI_TYPE_EN	FRIBIDI_TYPE_EN_VAL
+# define FRIBIDI_TYPE_AN	FRIBIDI_TYPE_AN_VAL
+# define FRIBIDI_TYPE_ES	FRIBIDI_TYPE_ES_VAL
+# define FRIBIDI_TYPE_ET	FRIBIDI_TYPE_ET_VAL
+# define FRIBIDI_TYPE_CS	FRIBIDI_TYPE_CS_VAL
+# define FRIBIDI_TYPE_NSM	FRIBIDI_TYPE_NSM_VAL
+# define FRIBIDI_TYPE_BN	FRIBIDI_TYPE_BN_VAL
+# define FRIBIDI_TYPE_BS	FRIBIDI_TYPE_BS_VAL
+# define FRIBIDI_TYPE_SS	FRIBIDI_TYPE_SS_VAL
+# define FRIBIDI_TYPE_WS	FRIBIDI_TYPE_WS_VAL
+# define FRIBIDI_TYPE_ON	FRIBIDI_TYPE_ON_VAL
+# define FRIBIDI_TYPE_LRE	FRIBIDI_TYPE_LRE_VAL
+# define FRIBIDI_TYPE_RLE	FRIBIDI_TYPE_RLE_VAL
+# define FRIBIDI_TYPE_LRO	FRIBIDI_TYPE_LRO_VAL
+# define FRIBIDI_TYPE_RLO	FRIBIDI_TYPE_RLO_VAL
+# define FRIBIDI_TYPE_PDF	FRIBIDI_TYPE_PDF_VAL
+
+typedef fribidi_uint32 FriBidiParType;
+# define FRIBIDI_PAR_LTR	FRIBIDI_TYPE_LTR_VAL
+# define FRIBIDI_PAR_RTL	FRIBIDI_TYPE_RTL_VAL
+# define FRIBIDI_PAR_ON		FRIBIDI_TYPE_ON_VAL
+# define FRIBIDI_PAR_WLTR	FRIBIDI_TYPE_WLTR_VAL
+# define FRIBIDI_PAR_WRTL	FRIBIDI_TYPE_WRTL_VAL
+
+#endif
+
+/* Just for compatibility */
+#define FRIBIDI_TYPE_WLTR	FRIBIDI_PAR_WLTR
+#define FRIBIDI_TYPE_WL		FRIBIDI_PAR_WLTR
+#define FRIBIDI_TYPE_WRTL	FRIBIDI_PAR_WRTL
+#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
 
 
 /*
@@ -187,6 +238,9 @@
 /* Is private-use value? */
 #define FRIBIDI_TYPE_PRIVATE(p)	((p) < 0)
 
+/* Is right-to-left level? */
+#define FRIBIDI_LEVEL_IS_RTL(lev) ((lev) & 1)
+
 /* Return the direction of the level number, FRIBIDI_TYPE_LTR for even and
    FRIBIDI_TYPE_RTL for odds. */
 #define FRIBIDI_LEVEL_TO_DIR(lev) (FRIBIDI_TYPE_LTR | ((lev) & 1))

Index: fribidi-bidi.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- a/fribidi-bidi.c	4 Jun 2004 16:43:51 -0000	1.9
+++ b/fribidi-bidi.c	7 Jun 2004 20:38:21 -0000	1.10
@@ -50,13 +50,6 @@
 # define MAX(a,b) ((a) > (b) ? (a) : (b))
 #endif /* !MAX */
 
-typedef struct
-{
-  FriBidiCharType override;	/* only LTR, RTL and ON are valid */
-  FriBidiLevel level;
-}
-LevelInfo;
-
 /* Some convenience macros */
 #define RL_TYPE(list) ((list)->type)
 #define RL_LEN(list) ((list)->len)
@@ -151,7 +144,7 @@
 
 static void
 print_types_re (
-  FriBidiRun *pp
+  const FriBidiRun *pp
 )
 {
   fribidi_assert (pp);
@@ -167,7 +160,7 @@
 
 static void
 print_resolved_levels (
-  FriBidiRun *pp
+  const FriBidiRun *pp
 )
 {
   fribidi_assert (pp);
@@ -175,7 +168,7 @@
   MSG ("  Res. levels: ");
   for_run_list (pp, pp)
   {
-    FriBidiStrIndex i;
+    register FriBidiStrIndex i;
     for (i = RL_LEN (pp); i; i--)
       MSG2 ("%c", fribidi_char_from_level (RL_LEVEL (pp)));
   }
@@ -184,7 +177,7 @@
 
 static void
 print_resolved_types (
-  FriBidiRun *pp
+  const FriBidiRun *pp
 )
 {
   fribidi_assert (pp);
@@ -203,13 +196,15 @@
 print_bidi_string (
   /* input */
   const FriBidiChar *str,
-  FriBidiStrIndex len
+  const FriBidiStrIndex len
 )
 {
+  register FriBidiStrIndex i;
+
   fribidi_assert (str);
 
   MSG ("  Org. types : ");
-  for (; len; len--)
+  for (i = len; i; i--)
     MSG2 ("%c", fribidi_char_from_bidi_type (fribidi_get_bidi_type (*str++)));
   MSG ("\n");
 }
@@ -306,22 +301,22 @@
 
 
 FRIBIDI_ENTRY FriBidiLevel
-fribidi_get_embedding_levels (
+fribidi_get_par_embedding_levels (
   /* input */
   const FriBidiChar *str,
-  FriBidiStrIndex len,
+  const FriBidiStrIndex len,
   /* input and output */
-  FriBidiCharType *pbase_dir,
+  FriBidiParType *pbase_dir,
   /* output */
   FriBidiLevel *embedding_level_list
 )
 {
   FriBidiLevel base_level, max_level = 0;
-  FriBidiCharType base_dir;
+  FriBidiParType base_dir;
   FriBidiRun *main_run_list = NULL, *explicits_list = NULL, *pp;
   fribidi_boolean status = false;
 
-  DBG ("entering fribidi_get_embedding_levels");
+  DBG ("entering fribidi_get_par_embedding_levels");
 
   fribidi_assert (str);
   fribidi_assert (pbase_dir);
@@ -376,7 +371,11 @@
     FriBidiCharType override, new_override;
     FriBidiStrIndex i;
     int stack_size, over_pushed, first_interval;
-    LevelInfo *status_stack;
+    struct
+    {
+      FriBidiCharType override;	/* only LTR, RTL and ON are valid */
+      FriBidiLevel level;
+    } *status_stack;
     FriBidiRun temp_link;
 
 /* explicits_list is a list like main_run_list, that holds the explicit
@@ -398,9 +397,8 @@
     stack_size = 0;
     over_pushed = 0;
     first_interval = 0;
-    status_stack =
-      (LevelInfo *) fribidi_malloc (sizeof (LevelInfo) *
-				    FRIBIDI_BIDI_MAX_RESOLVED_LEVELS);
+    status_stack = fribidi_malloc (sizeof (status_stack[0]) *
+				   FRIBIDI_BIDI_MAX_RESOLVED_LEVELS);
 
     for_run_list (pp, main_run_list)
     {
@@ -795,7 +793,7 @@
   status = true;
 
 out:
-  DBG ("leaving fribidi_get_embedding_levels");
+  DBG ("leaving fribidi_get_par_embedding_levels");
 
   if (main_run_list)
     free_run_list (main_run_list);
@@ -805,10 +803,39 @@
   return status ? max_level + 1 : 0;
 }
 
+
+FRIBIDI_ENTRY void
+fribidi_shape_mirroring (
+  /* input */
+  const FriBidiLevel *embedding_level_list,
+  const FriBidiStrIndex len,
+  /* input and output */
+  FriBidiChar *str
+)
+{
+  register FriBidiStrIndex i;
+
+  fribidi_assert (embedding_level_list);
+
+  if UNLIKELY
+    (len == 0 || !str) return;
+
+  /* L4. Mirror all characters that are in odd levels and have mirrors. */
+  for (i = len - 1; i >= 0; i--)
+    if (FRIBIDI_LEVEL_IS_RTL (embedding_level_list[i]))
+      {
+	FriBidiChar mirrored_ch;
+
+	if (fribidi_get_mirror_char (str[i], &mirrored_ch))
+	  str[i] = mirrored_ch;
+      }
+}
+
+
 static void
 bidi_string_reverse (
   FriBidiChar *str,
-  FriBidiStrIndex len
+  const FriBidiStrIndex len
 )
 {
   FriBidiStrIndex i;
@@ -826,7 +853,7 @@
 static void
 index_array_reverse (
   FriBidiStrIndex *arr,
-  FriBidiStrIndex len
+  const FriBidiStrIndex len
 )
 {
   FriBidiStrIndex i;
@@ -842,83 +869,24 @@
 }
 
 
-FRIBIDI_ENTRY FriBidiStrIndex
-fribidi_remove_bidi_marks (
-  FriBidiChar *str,
-  FriBidiStrIndex length,
-  FriBidiStrIndex *position_to_this_list,
-  FriBidiStrIndex *position_from_this_list,
-  FriBidiLevel *embedding_level_list
-)
-{
-  FriBidiStrIndex i, j;
-  fribidi_boolean private_from_this = false;
-
-  DBG ("entering fribidi_remove_bidi_marks");
-
-  /* If to_this is to not NULL, we must have from_this as well. If it is
-     not given by the caller, we have to make a private instance of it. */
-  if (position_to_this_list && !position_from_this_list)
-    {
-      private_from_this = true;
-      position_from_this_list =
-	(FriBidiStrIndex *) fribidi_malloc (sizeof (FriBidiStrIndex) *
-					    length);
-    }
-
-  j = 0;
-  for (i = 0; i < length; i++)
-    if (!FRIBIDI_IS_EXPLICIT (fribidi_get_bidi_type (str[i]))
-	&& str[i] != FRIBIDI_CHAR_LRM && str[i] != FRIBIDI_CHAR_RLM)
-      {
-	str[j] = str[i];
-	if (embedding_level_list)
-	  embedding_level_list[j] = embedding_level_list[i];
-	if (position_from_this_list)
-	  position_from_this_list[j] = position_from_this_list[i];
-	j++;
-      }
-
-  /* Convert the from_this list to to_this */
-  if (position_to_this_list)
-    {
-      DBG ("  converting from_this list to to_this");
-      for (i = 0; i < length; i++)
-	position_to_this_list[i] = -1;
-      for (i = 0; i < length; i++)
-	position_to_this_list[position_from_this_list[i]] = i;
-      DBG ("  converting from_this list to to_this, done");
-    }
-
-  if (private_from_this)
-    fribidi_free (position_from_this_list);
-
-  DBG ("leaving fribidi_remove_bidi_marks");
-  return j;
-}
-
-
 FRIBIDI_ENTRY FriBidiLevel
-fribidi_log2vis (
+fribidi_reorder_line (
   /* input */
-  const FriBidiChar *str,
-  FriBidiStrIndex len,
+  FriBidiLevel *embedding_level_list,
+  const FriBidiStrIndex len,
+  const FriBidiStrIndex off,
   /* input and output */
-  FriBidiCharType *pbase_dir,
+  FriBidiChar *str,
   /* output */
-  FriBidiChar *visual_str,
   FriBidiStrIndex *position_L_to_V_list,
-  FriBidiStrIndex *position_V_to_L_list,
-  FriBidiLevel *embedding_level_list
+  FriBidiStrIndex *position_V_to_L_list
 )
 {
-  FriBidiLevel max_level = 0;
   fribidi_boolean private_V_to_L = false;
-  fribidi_boolean private_embedding_level_list = false;
   fribidi_boolean status = false;
+  FriBidiLevel max_level = 0;
 
-  fribidi_assert (str);
-  fribidi_assert (pbase_dir);
+  fribidi_assert (embedding_level_list);
 
   if UNLIKELY
     (len == 0)
@@ -928,38 +896,24 @@
     }
 
   if UNLIKELY
-    (len > FRIBIDI_MAX_STRING_LENGTH && (position_V_to_L_list ||
-					 position_L_to_V_list))
+    (off + len > FRIBIDI_MAX_STRING_LENGTH && (position_V_to_L_list ||
+					       position_L_to_V_list))
     {
 #     if DEBUG
-      MSG2 (FRIBIDI ": cannot handle strings > %ld characters\n",
-	    (long) FRIBIDI_MAX_STRING_LENGTH);
+      MSG2 (FRIBIDI ": cannot handle strings > %lu characters\n",
+	    (unsigned long) FRIBIDI_MAX_STRING_LENGTH);
 #     endif /* DEBUG */
       goto out;
     }
 
-  if (!embedding_level_list)
-    {
-      embedding_level_list = fribidi_malloc (len);
-      if (!embedding_level_list)
-	goto out;
-      private_embedding_level_list = true;
-    }
-
-  max_level = fribidi_get_embedding_levels (str, len, pbase_dir,
-					    /* output */
-					    embedding_level_list) - 1;
-  if UNLIKELY
-    (max_level < 0) goto out;
-
   /* 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 (position_L_to_V_list && !position_V_to_L_list)
     {
       position_V_to_L_list =
-	(FriBidiStrIndex *) fribidi_malloc (sizeof (FriBidiStrIndex) * len);
-      if (!position_V_to_L_list)
-	goto out;
+	fribidi_malloc (sizeof (position_V_to_L_list[0]) * len);
+      if UNLIKELY
+	(!position_V_to_L_list) goto out;
       private_V_to_L = true;
     }
 
@@ -969,91 +923,78 @@
     register FriBidiLevel level;
     register FriBidiStrIndex i;
 
-    /* Set up the ordering array to sorted order */
+    /* Set up the ordering array to identity order */
     if (position_V_to_L_list)
       {
-	for (i = len - 1; i >= 0; i--)
+	for (i = off + len - 1; i >= off; i--)
 	  position_V_to_L_list[i] = i;
       }
-    /* Copy the logical string to the visual */
-    if (visual_str)
-      {
-	for (i = len - 1; i >= 0; i--)
-	  visual_str[i] = str[i];
-	visual_str[len] = 0;
-      }
-
-    if (fribidi_mirroring_status () && visual_str)
-      {
-	/* L4. Mirror all characters that are in odd levels and have mirrors. */
-	for (i = len - 1; i >= 0; i--)
-	  if (embedding_level_list[i] & 1)
-	    {
-	      FriBidiChar mirrored_ch;
-	      if (fribidi_get_mirror_char (visual_str[i], &mirrored_ch))
-		visual_str[i] = mirrored_ch;
-	    }
-      }
 
     /* Reorder both the outstring and the order array */
-    if (visual_str || position_V_to_L_list)
-      {
-	if (fribidi_reorder_nsm_status ())
-	  {
-	    /* L3. Reorder NSMs. */
-	    for (i = len - 1; i >= 0; i--)
-	      if ((embedding_level_list[i] & 1)
-		  && fribidi_get_bidi_type (str[i]) == FRIBIDI_TYPE_NSM)
-		{
-		  register FriBidiStrIndex seq_end = i;
-		  level = embedding_level_list[i];
-
-		  for (i--; i >= 0 &&
-		       FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM (fribidi_get_bidi_type
-							 (str[i]))
-		       && embedding_level_list[i] == level; i--)
-		    ;
-
-		  if (i < 0 || embedding_level_list[i] != level)
-		    {
-		      i++;
-		      DBG ("warning: NSM(s) at the beggining of level run");
-		    }
-
-		  if (visual_str)
-		    {
-		      bidi_string_reverse (visual_str + i, seq_end - i + 1);
-		    }
-		  if (position_V_to_L_list)
-		    {
-		      index_array_reverse (position_V_to_L_list + i,
-					   seq_end - i + 1);
-		    }
-		}
-	  }
-
-	/* L2. Reorder. */
-	for (level = max_level; level > 0; level--)
-	  for (i = len - 1; i >= 0; i--)
-	    if (embedding_level_list[i] >= level)
+    {
+      if (fribidi_reorder_nsm_status ())
+	{
+	  /* L3. Reorder NSMs. */
+	  for (i = off + len - 1; i >= off; i--)
+	    if (FRIBIDI_LEVEL_IS_RTL (embedding_level_list[i])
+		&& fribidi_get_bidi_type (str[i]) == FRIBIDI_TYPE_NSM)
 	      {
-		/* Find all stretches that are >= level_idx */
 		register FriBidiStrIndex seq_end = i;
-		for (i--; i >= 0 && embedding_level_list[i] >= level; i--)
+		level = embedding_level_list[i];
+
+		for (i--; i >= off &&
+		     FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM (fribidi_get_bidi_type
+						       (str[i]))
+		     && embedding_level_list[i] == level; i--)
 		  ;
 
-		if (visual_str)
-		  bidi_string_reverse (visual_str + i + 1, seq_end - i);
+		if (i < off || embedding_level_list[i] != level)
+		  {
+		    i++;
+		    DBG ("warning: NSM(s) at the beggining of level run");
+		  }
+
+		if (str)
+		  {
+		    bidi_string_reverse (str + i, seq_end - i + 1);
+		  }
 		if (position_V_to_L_list)
-		  index_array_reverse (position_V_to_L_list + i + 1, seq_end
-				       - i);
+		  {
+		    index_array_reverse (position_V_to_L_list + i,
+					 seq_end - i + 1);
+		  }
 	      }
-      }
+	}
+
+      /* Find max_level of the line.  We don't reuse the paragraph
+       * max_level, both for a cleaner API, and that the line max_level
+       * may be far less than paragraph max_level. */
+      for (i = off + len - 1; i >= off; i--)
+	if (embedding_level_list[i] > max_level)
+	  max_level = embedding_level_list[i];
+
+      /* L2. Reorder. */
+      for (level = max_level; level > 0; level--)
+	for (i = off + len - 1; i >= off; i--)
+	  if (embedding_level_list[i] >= level)
+	    {
+	      /* Find all stretches that are >= level_idx */
+	      register FriBidiStrIndex seq_end = i;
+	      for (i--; i >= off && embedding_level_list[i] >= level; i--)
+		;
+
+	      if (str)
+		bidi_string_reverse (str + i + 1, seq_end - i);
+	      if (position_V_to_L_list)
+		index_array_reverse (position_V_to_L_list + i + 1, seq_end
+				     - i);
+	    }
+    }
 
     /* Convert the v2l list to l2v */
     if (position_L_to_V_list)
       {
-	for (i = 0; i < len; i++)
+	for (i = off + len - 1; i >= off; i--)
 	  position_L_to_V_list[position_V_to_L_list[i]] = i;
       }
   }
@@ -1065,9 +1006,6 @@
   if (private_V_to_L)
     fribidi_free (position_V_to_L_list);
 
-  if (private_embedding_level_list)
-    fribidi_free (embedding_level_list);
-
   return status ? max_level + 1 : 0;
 }
 

Index: fribidi-bidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/fribidi-bidi.h	4 Jun 2004 16:43:51 -0000	1.5
+++ b/fribidi-bidi.h	7 Jun 2004 20:38:21 -0000	1.6
@@ -42,35 +42,8 @@
 
 #include "fribidi-begindecls.h"
 
-#define fribidi_log2vis FRIBIDI_NAMESPACE(log2vis)
-/* fribidi_log2vis - get visual string
- *
- * This function converts the logical input string to the visual output
- * strings as specified by the Unicode Bidirectional Algorithm.  As a side
- * effect it also generates mapping lists between the two strings, and the
- * list of embedding levels as defined by the algorithm.  If any of the the
- * lists are passed as NULL, the list is ignored and not filled.
- *
- * Returns: Maximum level found plus one, or zero if any error occured
- * (memory allocation failure most probably).
- */
-FRIBIDI_ENTRY FriBidiLevel
-fribidi_log2vis (
-  const FriBidiChar *str,	/* input logical string */
-  FriBidiStrIndex len,		/* input string length */
-  FriBidiCharType *pbase_dir,	/* requested and resolved paragraph
-				 * base direction */
-  FriBidiChar *visual_str,	/* output visual string */
-  FriBidiStrIndex *position_L_to_V_list,	/* output mapping from logical to 
-						 * visual string positions */
-  FriBidiStrIndex *position_V_to_L_list,	/* output mapping from visual string
-						 * back to the logical string
-						 * positions */
-  FriBidiLevel *embedding_level_list	/* output list of embedding levels */
-) FRIBIDI_GNUC_WARN_UNUSED;
-
-#define fribidi_get_embedding_levels FRIBIDI_NAMESPACE(get_embedding_levels)
-/* fribidi_get_embedding_levels - get bidi embedding levels
+#define fribidi_get_par_embedding_levels FRIBIDI_NAMESPACE(get_par_embedding_levels)
+/* fribidi_get_par_embedding_levels - get bidi embedding levels of a paragraph
  *
  * This function finds the bidi embedding levels of a single paragraph,
  * as defined by the Unicode Bidirectional Algorithm.
@@ -78,10 +51,11 @@
  * Returns: Maximum level found plus one, or zero if any error occured
  * (memory allocation failure most probably).
  */
-     FRIBIDI_ENTRY FriBidiLevel fribidi_get_embedding_levels (
-  const FriBidiChar *str,	/* input logical string */
-  FriBidiStrIndex len,		/* input string length */
-  FriBidiCharType *pbase_dir,	/* requested and resolved paragraph
+FRIBIDI_ENTRY FriBidiLevel
+fribidi_get_par_embedding_levels (
+  const FriBidiChar *str,	/* input paragraph string */
+  const FriBidiStrIndex len,	/* input string length of the paragraph */
+  FriBidiParType *pbase_dir,	/* requested and resolved paragraph
 				 * base direction */
   FriBidiLevel *embedding_level_list	/* output list of embedding levels */
 ) FRIBIDI_GNUC_WARN_UNUSED;
@@ -90,39 +64,43 @@
 /* fribidi_shape - do mirroring shaping
  *
  * This functions replaces mirroring characters on right-to-left embeddings in
- * strint str with their mirrored equivalent as returned by
+ * string str with their mirrored equivalent as returned by
  * fribidi_get_mirror_char().
- *
- * Returns: Non-zero if it was successful, or zero if any error occured
- * (memory allocation failure most probably).
  */
-     FRIBIDI_ENTRY fribidi_boolean fribidi_shape_mirroring (
-  const FriBidiChar *str,	/* string to shape */
-  FriBidiStrIndex len,		/* input string length */
-  FriBidiLevel *embedding_level_list	/* input list of embedding levels */
-) FRIBIDI_GNUC_WARN_UNUSED;
+     FRIBIDI_ENTRY void fribidi_shape_mirroring (
+  const FriBidiLevel *embedding_level_list,	/* input list of embedding
+						   levels, as returned by
+						   fribidi_get_par_embedding_levels */
+  const FriBidiStrIndex len,	/* input string length */
+  FriBidiChar *str		/* string to shape */
+);
 
-#define fribidi_remove_bidi_marks FRIBIDI_NAMESPACE(remove_bidi_marks)
-/* fribidi_remove_bidi_marks - remove bidi marks out an string
- *
- * This function removes the bidi marks out of an string and the
- * accompanying lists.  If any of the input lists are NULL, the list is
- * skipped.
+#define fribidi_reorder_line FRIBIDI_NAMESPACE(reorder_line)
+/* fribidi_reorder_line - reorder a line of logical string to visual
  *
- * Bugs: It is not clear that if the input string is a logical, or visual
- * string.  It is know to have problems handling position lists.  In short,
- * it should be avoided.
+ * This function reorders the characters in a line of text from logical
+ * to final visual order.  Also sets position maps if not NULL.  You can leave
+ * str NULL if all you need is the maps.  Some features of this function can
+ * be turned on/off using environmental settings functions fribidi_env_*.
  *
- * Returns: New length of the string.
+ * Returns: Maximum level found in this line plus one, or zero if any error
+ * occured (memory allocation failure most probably).
  */
-     FRIBIDI_ENTRY FriBidiStrIndex fribidi_remove_bidi_marks (
-  FriBidiChar *str,
-  FriBidiStrIndex length,
-  FriBidiStrIndex *position_to_this_list,
-  FriBidiStrIndex *position_from_this_list,
-  FriBidiLevel *embedding_level_list
+     FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line (
+  FriBidiLevel *embedding_level_list,	/* input list of embedding levels,
+					   as returned by
+					   fribidi_get_par_embedding_levels */
+  const FriBidiStrIndex len,	/* input length of the line */
+  const FriBidiStrIndex off,	/* input offset of the beginning of the line
+				   in the paragraph */
+  FriBidiChar *str,		/* string to shape */
+  FriBidiStrIndex *position_L_to_V_list,	/* output mapping from logical to
+						   visual string positions */
+  FriBidiStrIndex *position_V_to_L_list	/* output mapping from visual string
+					   back to logical string positions */
 ) FRIBIDI_GNUC_WARN_UNUSED;
 
+
 #include "fribidi-enddecls.h"
 
 #endif /* !_FRIBIDI_BIDI_H */

Index: fribidi-mirroring.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-mirroring.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/fribidi-mirroring.c	29 May 2004 11:32:23 -0000	1.7
+++ b/fribidi-mirroring.c	7 Jun 2004 20:38:21 -0000	1.8
@@ -20,7 +20,8 @@
  * along with GNU FriBidi; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
- * For licensing issues, contact <license at farsiweb.info>.
+ * For licensing issues, contact <license at farsiweb.info> or write to
+ * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
  */
 /* $Id$
  * $Author$

Index: fribidi-mirroring.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-mirroring.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/fribidi-mirroring.h	29 May 2004 11:32:23 -0000	1.5
+++ b/fribidi-mirroring.h	7 Jun 2004 20:38:21 -0000	1.6
@@ -20,7 +20,8 @@
  * along with GNU FriBidi; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
- * For licensing issues, contact <license at farsiweb.info>.
+ * For licensing issues, contact <license at farsiweb.info> or write to
+ * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
  */
 /* $Id$
  * $Author$

Index: fribidi.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- a/fribidi.c	31 May 2004 18:39:39 -0000	1.6
+++ b/fribidi.c	7 Jun 2004 20:38:21 -0000	1.7
@@ -37,6 +37,170 @@
 
 #include <fribidi.h>
 
+FRIBIDI_ENTRY void
+fribidi_shape (
+  /* input */
+  const FriBidiLevel *embedding_level_list,
+  const FriBidiStrIndex len,
+  /* input and output */
+  FriBidiChar *str
+)
+{
+  fribidi_assert (embedding_level_list);
+
+  if UNLIKELY
+    (len == 0 || !str) return;
+
+  fribidi_shape_mirroring (embedding_level_list, len, str);
+}
+
+
+FRIBIDI_ENTRY FriBidiStrIndex
+fribidi_remove_bidi_marks (
+  FriBidiChar *str,
+  const FriBidiStrIndex len,
+  FriBidiStrIndex *position_to_this_list,
+  FriBidiStrIndex *position_from_this_list,
+  FriBidiLevel *embedding_level_list
+)
+{
+  register FriBidiStrIndex i, j = 0;
+  fribidi_boolean private_from_this = false;
+  fribidi_boolean status = false;
+
+  fribidi_assert (str);
+
+  if UNLIKELY
+    (len == 0)
+    {
+      status = true;
+      goto out;
+    }
+
+  /* If to_this is to not NULL, we must have from_this as well. If it is
+     not given by the caller, we have to make a private instance of it. */
+  if (position_to_this_list && !position_from_this_list)
+    {
+      position_from_this_list = fribidi_malloc (sizeof
+						(position_from_this_list[0]) *
+						len);
+      if UNLIKELY
+	(!position_from_this_list) goto out;
+      private_from_this = true;
+      for (i = len - 1; i >= 0; i--)
+	position_from_this_list[position_to_this_list[i]] = i;
+    }
+
+  for (i = 0; i < len; i++)
+    if (!FRIBIDI_IS_EXPLICIT_OR_BN (fribidi_get_bidi_type (str[i]))
+	&& str[i] != FRIBIDI_CHAR_LRM && str[i] != FRIBIDI_CHAR_RLM)
+      {
+	str[j] = str[i];
+	if (embedding_level_list)
+	  embedding_level_list[j] = embedding_level_list[i];
+	if (position_from_this_list)
+	  position_from_this_list[j] = position_from_this_list[i];
+	j++;
+      }
+
+  /* Convert the from_this list to to_this */
+  if (position_to_this_list)
+    {
+      for (i = 0; i < len; i++)
+	position_to_this_list[i] = -1;
+      for (i = 0; i < len; i++)
+	position_to_this_list[position_from_this_list[i]] = i;
+    }
+
+  status = true;
+
+out:
+
+  if (private_from_this)
+    fribidi_free (position_from_this_list);
+
+  return status ? j : -1;
+}
+
+
+FRIBIDI_ENTRY FriBidiLevel
+fribidi_log2vis (
+  /* input */
+  const FriBidiChar *str,
+  FriBidiStrIndex len,
+  /* input and output */
+  FriBidiParType *pbase_dir,
+  /* output */
+  FriBidiChar *visual_str,
+  FriBidiStrIndex *position_L_to_V_list,
+  FriBidiStrIndex *position_V_to_L_list,
+  FriBidiLevel *embedding_level_list
+)
+{
+  FriBidiLevel max_level = 0;
+  fribidi_boolean private_V_to_L = false;
+  fribidi_boolean private_embedding_level_list = false;
+  fribidi_boolean status = false;
+
+  fribidi_assert (str);
+  fribidi_assert (pbase_dir);
+
+  if UNLIKELY
+    (len == 0)
+    {
+      status = true;
+      goto out;
+    }
+
+  if (!embedding_level_list)
+    {
+      embedding_level_list = fribidi_malloc (len);
+      if (!embedding_level_list)
+	goto out;
+      private_embedding_level_list = true;
+    }
+
+  max_level = fribidi_get_par_embedding_levels (str, len, pbase_dir,
+						embedding_level_list) - 1;
+  if UNLIKELY
+    (max_level < 0) goto out;
+
+  /* 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 (position_L_to_V_list && !position_V_to_L_list)
+    {
+      position_V_to_L_list =
+	(FriBidiStrIndex *) fribidi_malloc (sizeof (FriBidiStrIndex) * len);
+      if (!position_V_to_L_list)
+	goto out;
+      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_level_list, len, visual_str);
+
+  status = fribidi_reorder_line (embedding_level_list, len, 0, visual_str,
+				 position_L_to_V_list, position_V_to_L_list);
+
+out:
+
+  if (private_V_to_L)
+    fribidi_free (position_V_to_L_list);
+
+  if (private_embedding_level_list)
+    fribidi_free (embedding_level_list);
+
+  return status ? max_level + 1 : 0;
+}
+
+
 const char *fribidi_unicode_version = FRIBIDI_UNICODE_VERSION;
 
 const char *fribidi_version_info =

Index: fribidi.def
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.def,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fribidi.def	4 Jun 2004 09:41:11 -0000	1.2
+++ b/fribidi.def	7 Jun 2004 20:38:21 -0000	1.3
@@ -4,7 +4,7 @@
 fribidi_get_type
 fribidi_get_types
 fribidi_log2vis
-fribidi_get_embedding_levels
+fribidi_get_par_embedding_levels
 fribidi_remove_bidi_marks
 fribidi_get_mirror_char
 fribidi_debug_status

Index: fribidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- a/fribidi.h	25 Apr 2004 18:47:57 -0000	1.1.1.1
+++ b/fribidi.h	7 Jun 2004 20:38:21 -0000	1.2
@@ -32,16 +32,97 @@
 #ifndef _FRIBIDI_H
 #define _FRIBIDI_H
 
-#include "fribidi-bidi.h"
-#include "fribidi-bidi-type.h"
+#include "fribidi-unicode.h"
+#include "fribidi-types.h"
 #include "fribidi-env.h"
+#include "fribidi-bidi-type.h"
+#include "fribidi-bidi.h"
 #include "fribidi-mirroring.h"
-#include "fribidi-types.h"
-#include "fribidi-unicode.h"
 #if FRIBIDI_CHARSETS
 # include "fribidi-char-sets.h"
 #endif /* FRIBIDI_CHARSETS */
 
+
+#define fribidi_shape FRIBIDI_NAMESPACE(shape)
+/* fribidi_shape - do bidi-dependent shaping
+ *
+ * This function does all shaping work that depends on the resolved embedding
+ * levels of the characters.  Currently it does mirroring and Arabic shaping,
+ * but the list may grow later.  Individual shaping features can be turned
+ * on/off using environmental setting functions fribidi_env_*.
+ */
+FRIBIDI_ENTRY void fribidi_shape (
+  const FriBidiLevel *embedding_level_list,	/* input list of embedding
+						   levels, as returned by
+						   fribidi_get_par_embedding_levels */
+  const FriBidiStrIndex len,	/* input string length */
+  FriBidiChar *str		/* string to shape */
+);
+
+#define fribidi_remove_bidi_marks FRIBIDI_NAMESPACE(remove_bidi_marks)
+/* fribidi_remove_bidi_marks - remove bidi marks out of an string
+ *
+ * This function removes the bidi and boundary-neutral marks out of an string
+ * and the accompanying lists.  If any of the input lists are NULL, the list
+ * is skipped.  If str is the visual string, then position_to_this_list is
+ * position_L_to_V_list and position_from_this_list is position_V_to_L_list;
+ * if str is the logical string, the other way.  Moreover, the position maps
+ * should be filled with valid entries.  A position map pointing to a removed
+ * character is filled with -1. By the way, you should not use
+ * embedding_level_list if str is visual string.  For best results it should
+ * be run on a whole paragraph, not lines; but feel free to do otherwise if
+ * you know what you are doing.
+ *
+ * Returns: New length of the string, or -1 if an error occured (memory
+ * allocation failure most probably).
+ */
+FRIBIDI_ENTRY FriBidiStrIndex
+fribidi_remove_bidi_marks (
+  FriBidiChar *str,		/* input string to clean */
+  const FriBidiStrIndex len,	/* input string length */
+  FriBidiStrIndex *position_to_this_list,	/* list mapping positions to the
+						   order used in str */
+  FriBidiStrIndex *position_from_this_list,	/* list mapping positions from the
+						   order used in str */
+  FriBidiLevel *embedding_level_list	/* list of embedding levels */
+) FRIBIDI_GNUC_WARN_UNUSED;
+
+
+/* Deprecated interface: */
+
+#define fribidi_log2vis FRIBIDI_NAMESPACE(log2vis)
+/* fribidi_log2vis - get visual string
+ *
+ * This function converts the logical input string to the visual output
+ * strings as specified by the Unicode Bidirectional Algorithm.  As a side
+ * effect it also generates mapping lists between the two strings, and the
+ * list of embedding levels as defined by the algorithm.  If any of the the
+ * lists are passed as NULL, the list is ignored and not filled.  This
+ * function is obsolete because it only handles one-line paragraphs. 
+ * Please consider using other functions instead. Deprecated.
+ *
+ * Returns: Maximum level found plus one, or zero if any error occured
+ * (memory allocation failure most probably).
+ */
+     FRIBIDI_ENTRY FriBidiLevel fribidi_log2vis (
+  const FriBidiChar *str,	/* input logical string */
+  const FriBidiStrIndex len,	/* input string length */
+  FriBidiParType *pbase_dir,	/* requested and resolved paragraph
+				 * base direction */
+  FriBidiChar *visual_str,	/* output visual string */
+  FriBidiStrIndex *position_L_to_V_list,	/* output mapping from logical to 
+						 * visual string positions */
+  FriBidiStrIndex *position_V_to_L_list,	/* output mapping from visual string
+						 * back to the logical string
+						 * positions */
+  FriBidiLevel *embedding_level_list	/* output list of embedding levels */
+)
+     FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED;
+
+
+#define fribidi_log2vis_get_embedding_levels fribidi_get_par_embedding_levels
+
+
 #endif /* !_FRIBIDI_H */
 /* Editor directions:
  * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent




More information about the FriBidi-Commit mailing list