T168_111\appl\Text\FriBidi文件:第17~31个

fribidi-bidi-types-list.h   、、、、、、、、、、、、、、、、、、、、、、、

#ifndef __FRIBIDI_DOC
/* FriBidi
 * fribidi-bidi-types-list.h - list of bidi types
 *
 * $Id: fribidi-bidi-types-list.h,v 1.5 2004/06/13 20:11:42 behdad Exp $
 * $Author: behdad $
 * $Date: 2004/06/13 20:11:42 $
 * $Revision: 1.5 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-bidi-types-list.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */
/* *INDENT-OFF* */
#endif /* !__FRIBIDI_DOC */
#ifndef _FRIBIDI_ADD_TYPE
# define _FRIBIDI_ADD_TYPE(x,y)
#endif
#ifndef _FRIBIDI_ADD_ALIAS
# define _FRIBIDI_ADD_ALIAS(x1,x2)
#endif

#if !defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES)

_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 */
_FRIBIDI_ADD_TYPE (EN, '1')    /* European Numeral */
_FRIBIDI_ADD_TYPE (AN, '9')    /* Arabic Numeral */
_FRIBIDI_ADD_TYPE (ES, 'w')    /* European number Separator */
_FRIBIDI_ADD_TYPE (ET, 'w')    /* European number Terminator */
_FRIBIDI_ADD_TYPE (CS, 'w')    /* Common Separator */
_FRIBIDI_ADD_TYPE (NSM, '`')    /* Non Spacing Mark */
_FRIBIDI_ADD_TYPE (BN, 'b')    /* Boundary Neutral */
_FRIBIDI_ADD_TYPE (BS, 'B')    /* Block Separator */
_FRIBIDI_ADD_TYPE (SS, 'S')    /* Segment Separator */
_FRIBIDI_ADD_TYPE (WS, '_')    /* WhiteSpace */
_FRIBIDI_ADD_TYPE (ON, 'n')    /* Other Neutral */
_FRIBIDI_ADD_TYPE (LRE, '+')    /* Left-to-Right Embedding */
_FRIBIDI_ADD_TYPE (RLE, '+')    /* Right-to-Left Embedding */
_FRIBIDI_ADD_TYPE (LRO, '+')    /* Left-to-Right Override */
_FRIBIDI_ADD_TYPE (RLO, '+')    /* Right-to-Left Override */
_FRIBIDI_ADD_TYPE (PDF, '-')    /* Pop Directional Flag */

#if defined(_FRIBIDI_ADD_ALIAS)
_FRIBIDI_ADD_ALIAS (L, LTR)
_FRIBIDI_ADD_ALIAS (R, RTL)
_FRIBIDI_ADD_ALIAS (B, BS)
_FRIBIDI_ADD_ALIAS (S, SS)
#endif /* _FRIBIDI_ADD_ALIAS */

#if defined(_FRIBIDI_SENTINEL_TYPE) || defined(_FRIBIDI_ALL_TYPES)
_FRIBIDI_ADD_TYPE (SENTINEL, '$')    /* SENTINEL */
#endif /* _FRIBIDI_SENTINEL_TYPES || _FRIBIDI_ALL_TYPES*/
#endif /* !_FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES */

#if defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES)
# if !defined(_FRIBIDI_ALL_TYPES)
_FRIBIDI_ADD_TYPE (LTR, 'L')    /* Left-To-Right paragraph */
_FRIBIDI_ADD_TYPE (RTL, 'R')    /* Right-To-Left paragraph */
_FRIBIDI_ADD_TYPE (ON, 'n')    /* directiOn-Neutral paragraph */
# endif /* !_FRIBIDI_ALL_TYPES */
_FRIBIDI_ADD_TYPE (WLTR, 'l')    /* Weak Left To Right paragraph */
_FRIBIDI_ADD_TYPE (WRTL, 'r')    /* Weak Right To Left paragraph */
#endif /* _FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES*/

#if defined(_FRIBIDI_ENUM_TYPES)
typedef enum {
# define _FRIBIDI_ADD_TYPE _FRIBIDI_ENUM_ADD_TYPE
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
  _FRIBIDI_TYPES_MAX
} _FRIBIDI_ENUM_TYPES
#endif /* _FRIBIDI_ENUM_TYPES */

#ifndef __FRIBIDI_DOC
/* *INDENT-ON* */
#endif /* !__FRIBIDI_DOC */
 

fribidi-common.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-common.h - common include for library headers
 *
 * $Id: fribidi-common.h,v 1.13 2007/04/05 16:13:24 behdad Exp $
 * $Author: behdad $
 * $Date: 2007/04/05 16:13:24 $
 * $Revision: 1.13 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-common.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _FRIBIDI_COMMON_H
#define _FRIBIDI_COMMON_H

#include "config.h"

#if DONT_HAVE_FRIBIDI_CONFIG_H+0
# define FRIBIDI "fribidi"
# define FRIBIDI_NAME "fribidi"
# define FRIBIDI_VERSION "unknown"
# define FRIBIDI_BUGREPORT "unknown"
# define FRIBIDI_INTERFACE_VERSION_STRING "unknown"
#else /* !DONT_HAVE_FRIBIDI_CONFIG_H */
# include "fribidi-config.h"
#endif /* !DONT_HAVE_FRIBIDI_CONFIG_H */

#if HAVE_FRIBIDI_CUSTOM_H+0
# include "fribidi-custom.h"
#endif /* HAVE_FRIBIDI_CUSTOM_H */

/* FRIBIDI_NAMESPACE is a macro used to name library symbols. */
#ifndef FRIBIDI_NAMESPACE
# define FRIBIDI_NAMESPACE(SYMBOL) fribidi##_##SYMBOL
#endif /* !FRIBIDI_NAMESPACE */

/* FRIBIDI_ENTRY is a macro used to declare library entry points. */
#ifndef FRIBIDI_ENTRY
# if (defined(WIN32)) || (defined(_WIN32_WCE))
#  define FRIBIDI_ENTRY __declspec(dllimport)
# else /* !WIN32 */
#  define FRIBIDI_ENTRY        /* empty */
# endif    /* !WIN32 */
#endif /* !FRIBIDI_ENTRY */

#if FRIBIDI_USE_GLIB+0
# ifndef __FRIBIDI_DOC
#  include <glib/gmacros.h>
# endif    /* !__FRIBIDI_DOC */
# define FRIBIDI_BEGIN_DECLS        G_BEGIN_DECLS
# define FRIBIDI_END_DECLS        G_END_DECLS
# define FRIBIDI_GNUC_CONST        G_GNUC_CONST
# define FRIBIDI_GNUC_DEPRECATED    G_GNUC_DEPRECATED
# if __GNUC__ > 2
#  define FRIBIDI_GNUC_WARN_UNUSED    \
    __attribute__((__warn_unused_result__))
#  define FRIBIDI_GNUC_MALLOC        \
    __attribute__((__malloc__))
#  define FRIBIDI_GNUC_HIDDEN        \
    __attribute__((__visibility__ ("hidden")))
# else /* __GNUC__ <= 2 */
#  define FRIBIDI_GNUC_WARN_UNUSED
#  define FRIBIDI_GNUC_MALLOC
#  define FRIBIDI_GNUC_HIDDEN
# endif    /* __GNUC__ <= 2 */
#else /* !FRIBIDI_USE_GLIB */
# define FRIBIDI_GNUC_CONST
# define FRIBIDI_GNUC_DEPRECATED
# define FRIBIDI_GNUC_WARN_UNUSED
# define FRIBIDI_GNUC_MALLOC
# define FRIBIDI_GNUC_HIDDEN
#endif /* !FRIBIDI_USE_GLIB */

/* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations,
 * so that C++ compilers don't mangle their names.  Use FRIBIDI_END_DECLS at
 * the end of C declarations. */
#ifndef FRIBIDI_BEGIN_DECLS
# ifdef __cplusplus
#  define FRIBIDI_BEGIN_DECLS extern "C" {
#  define FRIBIDI_END_DECLS }
# else /* !__cplusplus */
#  define FRIBIDI_BEGIN_DECLS    /* empty */
#  define FRIBIDI_END_DECLS    /* empty */
# endif    /* !__cplusplus */
#endif /* !FRIBIDI_BEGIN_DECLS */


#define fribidi_debug_status FRIBIDI_NAMESPACE(debug_status)
FRIBIDI_ENTRY int fribidi_debug_status (
  void
);
#define fribidi_set_debug FRIBIDI_NAMESPACE(set_debug)
FRIBIDI_ENTRY int
fribidi_set_debug (
  int state        /* new state to set */
);

#endif /* !_FRIBIDI_COMMON_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-config.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#ifndef _FRIBIDI_CONFIG_H
#define _FRIBIDI_CONFIG_H

#define FRIBIDI "fribidi"
#define FRIBIDI_NAME "fribidi"
#define FRIBIDI_BUGREPORT "unknown"

#define FRIBIDI_VERSION "0.19.2"
#define FRIBIDI_MAJOR_VERSION 0
#define FRIBIDI_MINOR_VERSION 19
#define FRIBIDI_MICRO_VERSION 2
#define FRIBIDI_INTERFACE_VERSION 0
#define FRIBIDI_INTERFACE_VERSION_STRING "unknown"

#define FRIBIDI_INT_TYPES 0

/* Define to 1 if you want charset conversion codes in the library */
#define FRIBIDI_CHARSETS 0

/* Define to 1 if you don't want deprecated interface codes in the library */
#define FRIBIDI_NO_DEPRECATED 0

/* Define to 1 if you want to use glib */
#define FRIBIDI_USE_GLIB 0

/* The size of a `int', as computed by sizeof. */
#define FRIBIDI_SIZEOF_INT 4

#endif /* !_FRIBIDI_CONFIG_H */
 

fribidi-deprecated.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-deprecated.c - deprecated interfaces.
 *
 * $Id: fribidi-deprecated.c,v 1.6 2006/06/01 22:53:55 behdad Exp $
 * $Author: behdad $
 * $Date: 2006/06/01 22:53:55 $
 * $Revision: 1.6 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-deprecated.c,v $
 *
 * Authors:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *   Dov Grobgeld, 1999, 2000
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * Copyright (C) 1999,2000 Dov Grobgeld
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */

#include "common.h"

#include "fribidi-deprecated.h"
#include "fribidi.h"

#if FRIBIDI_NO_DEPRECATED+0
#else

static FriBidiFlags flags = FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC;

FRIBIDI_ENTRY fribidi_boolean
fribidi_set_mirroring (
  /* input */
  fribidi_boolean state
)
{
  return FRIBIDI_ADJUST_AND_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING, state);
}

FRIBIDI_ENTRY fribidi_boolean
fribidi_mirroring_status (
  void
)
{
  return FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING);
}

FRIBIDI_ENTRY fribidi_boolean
fribidi_set_reorder_nsm (
  /* input */
  fribidi_boolean state
)
{
  return FRIBIDI_ADJUST_AND_TEST_BITS (flags, FRIBIDI_FLAG_REORDER_NSM, state);
}

fribidi_boolean
fribidi_reorder_nsm_status (
  void
)
{
  return FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_REORDER_NSM);
}


FRIBIDI_ENTRY FriBidiLevel
fribidi_log2vis_get_embedding_levels (
  const FriBidiCharType *bidi_types,    /* input list of bidi types as returned by
                       fribidi_get_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 */
)
{
  return fribidi_get_par_embedding_levels (bidi_types, len, pbase_dir, embedding_levels);
}

FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type (
  FriBidiChar ch        /* input character */
)
{
  return fribidi_get_bidi_type (ch);
}

FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type_internal (
  FriBidiChar ch        /* input character */
)
{
  return fribidi_get_bidi_type (ch);
}

FRIBIDI_ENTRY FriBidiStrIndex
fribidi_remove_bidi_marks (
  FriBidiChar *str,
  const FriBidiStrIndex len,
  FriBidiStrIndex *positions_to_this,
  FriBidiStrIndex *position_from_this_list,
  FriBidiLevel *embedding_levels
)
{
  register FriBidiStrIndex i, j = 0;
  fribidi_boolean private_from_this = false;
  fribidi_boolean status = false;

  if UNLIKELY
    (len == 0)
    {
      status = true;
      goto out;
    }

  DBG ("in fribidi_remove_bidi_marks");

  fribidi_assert (str);

  /* If to_this is 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 (positions_to_this && !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 = 0; i < len; i++)
    position_from_this_list[positions_to_this[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_levels)
      embedding_levels[j] = embedding_levels[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 (positions_to_this)
    {
      for (i = 0; i < len; i++)
    positions_to_this[i] = -1;
      for (i = 0; i < len; i++)
    positions_to_this[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,
  const FriBidiStrIndex len,
  /* input and output */
  FriBidiParType *pbase_dir,
  /* output */
  FriBidiChar *visual_str,
  FriBidiStrIndex *positions_L_to_V,
  FriBidiStrIndex *positions_V_to_L,
  FriBidiLevel *embedding_levels
)
{
  register FriBidiStrIndex i;
  FriBidiLevel max_level = 0;
  fribidi_boolean private_V_to_L = false;
  fribidi_boolean private_embedding_levels = false;
  fribidi_boolean status = false;
  FriBidiArabicProp *ar_props = NULL;
  FriBidiCharType *bidi_types = NULL;

  if UNLIKELY
    (len == 0)
    {
      status = true;
      goto out;
    }

  DBG ("in 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]);
      if (!embedding_levels)
    goto out;
      private_embedding_levels = true;
    }

  max_level = fribidi_get_par_embedding_levels (bidi_types, len, pbase_dir,
                        embedding_levels) - 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 (positions_L_to_V && !positions_V_to_L)
    {
      positions_V_to_L =
    (FriBidiStrIndex *) fribidi_malloc (sizeof (FriBidiStrIndex) * len);
      if (!positions_V_to_L)
    goto out;
      private_V_to_L = true;
    }

  /* Set up the ordering array to identity order */
  if (positions_V_to_L)
    {
      for (i = 0; i < len; i++)
    positions_V_to_L[i] = i;
    }


  if (visual_str)
    {
      /* Using memcpy instead
      for (i = len - 1; i >= 0; i--)
    visual_str[i] = str[i];
      */
      memcpy (visual_str, str, len * sizeof (*visual_str));

      /* Arabic joining */
      ar_props = fribidi_malloc (len * sizeof ar_props[0]);
      fribidi_get_joining_types (str, len, ar_props);
      fribidi_join_arabic (bidi_types, len, embedding_levels, ar_props);

      fribidi_shape (flags, embedding_levels, len, ar_props, visual_str);
    }

  /* line breaking goes here, but we assume one line in this function */

  /* and this should be called once per line, but again, we assume one
   * line in this deprecated function */
  status =
    fribidi_reorder_line (flags, bidi_types, len, 0, *pbase_dir,
              embedding_levels, visual_str,
              positions_V_to_L);

  /* Convert the v2l list to l2v */
  if (positions_L_to_V)
    {
      for (i = 0; i < len; i++)
    positions_L_to_V[i] = -1;
      for (i = 0; i < len; i++)
    positions_L_to_V[positions_V_to_L[i]] = i;
    }

out:

  if (private_V_to_L)
    fribidi_free (positions_V_to_L);

  if (private_embedding_levels)
    fribidi_free (embedding_levels);

  if (ar_props)
    fribidi_free (ar_props);

  if (bidi_types)
    fribidi_free (bidi_types);

  return status ? max_level + 1 : 0;
}

#endif /* !FRIBIDI_NO_DEPRECATED */

/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-deprecated.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-deprecated.h - Deprecated interfaces
 *
 * $Id: fribidi-deprecated.h,v 1.3 2006/01/31 03:23:13 behdad Exp $
 * $Author: behdad $
 * $Date: 2006/01/31 03:23:13 $
 * $Revision: 1.3 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-deprecated.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2004, 2005
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2004, 2005 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _FRIBIDI_DEPRECATED_H
#define _FRIBIDI_DEPRECATED_H

#include "fribidi-common.h"

#include "fribidi-types.h"

#include "fribidi-bidi-types.h"

#include "fribidi-begindecls.h"

#define fribidi_mirroring_status FRIBIDI_NAMESPACE(mirroring_status)
/* fribidi_mirroring_status - get current mirroring status
 *
 * This function is deprecated and only used with other deprecated functions.
 */
     FRIBIDI_ENTRY fribidi_boolean fribidi_mirroring_status (
  void
) FRIBIDI_GNUC_DEPRECATED;

#define fribidi_set_mirroring FRIBIDI_NAMESPACE(set_mirroring)
/* fribidi_set_mirroring - set mirroring on or off
 *
 * This function is used to turn character mirroring on or off.
 * Character mirroring is the act of replacing a mirrorable glyph
 * (character), eg. left paranthesis, with the matching glyph, 
 * eg. right paranthesis, in a right-to-left resolved context.
 * If your rendering engine does mirroring itself, you may want to 
 * turn it off here.
 *
 * This flag is on by default.
 * This function is deprecated and only used with other deprecated functions.
 *
 * Returns: the new mirroring status.
 */
     FRIBIDI_ENTRY fribidi_boolean fribidi_set_mirroring (
  fribidi_boolean state        /* new state to set */
) FRIBIDI_GNUC_DEPRECATED;


#define fribidi_reorder_nsm_status FRIBIDI_NAMESPACE(reorder_nsm_status)
/* fribidi_reorder_nsm_status - get current marks reordering status
 *
 * This function is deprecated and only used with other deprecated functions.
 */
     FRIBIDI_ENTRY fribidi_boolean fribidi_reorder_nsm_status (
  void
) FRIBIDI_GNUC_DEPRECATED;

#define fribidi_set_reorder_nsm FRIBIDI_NAMESPACE(set_reorder_nsm)
/* fribidi_set_reorder_nsm - set marks reordering on or off
 *
 * This function is used to turn non-spacing marks reordering on or
 * off.  Reordering non-spacing marks is the act of placing non-spacing
 * marks (bidi class NSM) after their base character in a right-to-left
 * resolved context.  If your rendering engine expects non-spacing marks
 * always after the base character in the memory representation of the
 * visual string, you need this option on.  An example of where people
 * may need it off is when rendering in the console when non-spacing
 * marks cannot be applied on top of the base character.
 *
 * This flag is on by default.
 * This function is deprecated and only used with other deprecated functions.
 *
 * Returns: the new marks reordering status.
 */
     FRIBIDI_ENTRY fribidi_boolean fribidi_set_reorder_nsm (
  fribidi_boolean state        /* new state to set */
) FRIBIDI_GNUC_DEPRECATED;


/* fribidi_log2vis_get_embedding_levels - get embedding levels
 *
 * Deprecated. Replaced by fribidi_get_par_embedding_levels.
 */
#define fribidi_log2vis_get_embedding_levels FRIBIDI_NAMESPACE(log2vis_get_embedding_levels)
FRIBIDI_ENTRY FriBidiLevel
fribidi_log2vis_get_embedding_levels (
  const FriBidiCharType *bidi_types,    /* input list of bidi types as returned by
                       fribidi_get_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 */
) FRIBIDI_GNUC_DEPRECATED;

/* fribidi_get_type - get character bidi type
 *
 * Deprecated. Replaced by fribidi_get_bidi_type.
 */
#define fribidi_get_type FRIBIDI_NAMESPACE(get_type)
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type (
  FriBidiChar ch        /* input character */
) FRIBIDI_GNUC_DEPRECATED;

/* fribidi_get_type_internal - get character bidi type
 *
 * Deprecated. Replaced by fribidi_get_bidi_type.
 */
#define fribidi_get_type_internal FRIBIDI_NAMESPACE(get_type_internal)
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type_internal (
  FriBidiChar ch        /* input character */
) FRIBIDI_GNUC_DEPRECATED;

#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.  It implements rule X9 of the Unicode
 * Bidirectional Algorithm available at
 * http://www.unicode.org/reports/tr9/#X9, with the exception that it removes
 * U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK too.
 *
 * If any of the input lists are NULL, the list is skipped.  If str is the
 * visual string, then positions_to_this is  positions_L_to_V and
 * position_from_this_list is positions_V_to_L;  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_levels if str is visual string.
 * 
 * For best results this function should be run on a whole paragraph, not
 * lines; but feel free to do otherwise if you know what you are doing.
 * Deprecated.  Use fribidi_remove_special_chars instead.
 *
 * 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 *positions_to_this,    /* 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_levels    /* list of embedding levels */
)
     FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED;


#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 NULL is passed as any of the the lists, 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 *positions_L_to_V,    /* output mapping from logical to 
                     * visual string positions */
  FriBidiStrIndex *positions_V_to_L,    /* output mapping from visual string
                     * back to the logical string
                     * positions */
  FriBidiLevel *embedding_levels    /* output list of embedding levels */
)
     FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED;


#define UNI_MAX_BIDI_LEVEL    FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL
#define UNI_LRM            FRIBIDI_CHAR_LRM
#define UNI_RLM            FRIBIDI_CHAR_RLM
#define UNI_LRE            FRIBIDI_CHAR_LRE
#define UNI_RLE            FRIBIDI_CHAR_RLE
#define UNI_LRO            FRIBIDI_CHAR_LRO
#define UNI_RLO            FRIBIDI_CHAR_RLO
#define UNI_LS            FRIBIDI_CHAR_LS
#define UNI_PS            FRIBIDI_CHAR_PS
#define UNI_ZWNJ        FRIBIDI_CHAR_ZWNJ
#define UNI_ZWJ            FRIBIDI_CHAR_ZWJ
#define UNI_HEBREW_ALEF        FRIBIDI_CHAR_HEBREW_ALEF
#define UNI_ARABIC_ALEF        FRIBIDI_CHAR_ARABIC_ALEF
#define UNI_ARABIC_ZERO        FRIBIDI_CHAR_ARABIC_ZERO
#define UNI_FARSI_ZERO        FRIBIDI_CHAR_PERSIAN_ZERO

#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

#include "fribidi-enddecls.h"

#endif /* !_FRIBIDI_DEPRECATED_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-enddecls.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#ifdef FRIBIDI_END_DECLS
FRIBIDI_END_DECLS
#endif /* FRIBIDI_END_DECLS */
 

fribidi-flags.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-flags.h - option flags
 *
 * $Id: fribidi-flags.h,v 1.1 2005/11/03 01:39:01 behdad Exp $
 * $Author: behdad $
 * $Date: 2005/11/03 01:39:01 $
 * $Revision: 1.1 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-flags.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2005
 *
 * Copyright (C) 2005 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _FRIBIDI_FLAGS_H
#define _FRIBIDI_FLAGS_H

#include "fribidi-common.h"

#include "fribidi-types.h"

#include "fribidi-begindecls.h"

typedef fribidi_uint32 FriBidiFlags;

/* 
 * Define option flags that various functions use. Each mask has
 * only one bit set.
 */

#define FRIBIDI_FLAG_SHAPE_MIRRORING    0x00000001
#define FRIBIDI_FLAG_REORDER_NSM    0x00000002

#define FRIBIDI_FLAG_SHAPE_ARAB_PRES    0x00000100
#define FRIBIDI_FLAG_SHAPE_ARAB_LIGA    0x00000200
#define FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE    0x00000400

#define FRIBIDI_FLAG_REMOVE_BIDI    0x00010000
#define FRIBIDI_FLAG_REMOVE_JOINING    0x00020000
#define FRIBIDI_FLAG_REMOVE_SPECIALS    0x00040000


/*
 * And their combinations.
 */

#define FRIBIDI_FLAGS_DEFAULT        ( \
    FRIBIDI_FLAG_SHAPE_MIRRORING    | \
    FRIBIDI_FLAG_REORDER_NSM    | \
    FRIBIDI_FLAG_REMOVE_SPECIALS    )

#define FRIBIDI_FLAGS_ARABIC        ( \
    FRIBIDI_FLAG_SHAPE_ARAB_PRES    | \
    FRIBIDI_FLAG_SHAPE_ARAB_LIGA    )

#include "fribidi-enddecls.h"

#endif /* !_FRIBIDI_FLAGS_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-joining.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-joining.h - Arabic joining algorithm
 *
 * $Id: fribidi-joining.c,v 1.6 2006/01/31 03:23:13 behdad Exp $
 * $Author: behdad $
 * $Date: 2006/01/31 03:23:13 $
 * $Revision: 1.6 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining.c,v $
 *
 * Authors:
 *   Behdad Esfahbod, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2004 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */

#include "common.h"

#include "fribidi-joining.h"

#include "mem.h"
#include "bidi-types.h"
#include "joining-types.h"

#if DEBUG+0
/*======================================================================
 *  For debugging, define some functions for printing joining types and
 *  properties.
 *----------------------------------------------------------------------*/

static void
print_joining_types (
  /* input */
  const FriBidiLevel *embedding_levels,
  const FriBidiStrIndex len,
  const FriBidiJoiningType *jtypes
)
{
  register FriBidiStrIndex i;

  fribidi_assert (jtypes);

  MSG ("  Join. types: ");
  for (i = 0; i < len; i++)
    MSG2 ("%c", fribidi_char_from_joining_type (jtypes[i],
                        !FRIBIDI_LEVEL_IS_RTL
                        (embedding_levels[i])));
  MSG ("\n");
}
#endif /* DEBUG */

#define FRIBIDI_CONSISTENT_LEVEL(i)    \
    (FRIBIDI_IS_EXPLICIT_OR_BN (bidi_types[(i)])    \
     ? FRIBIDI_SENTINEL    \
     : embedding_levels[(i)])

#define FRIBIDI_LEVELS_MATCH(i, j)    \
    ((i) == (j) || (i) == FRIBIDI_SENTINEL || (j) == FRIBIDI_SENTINEL)

FRIBIDI_ENTRY void
fribidi_join_arabic (
  /* input */
  const FriBidiCharType *bidi_types,
  const FriBidiStrIndex len,
  const FriBidiLevel *embedding_levels,
  /* input and output */
  FriBidiArabicProp *ar_props
)
{
  if UNLIKELY
    (len == 0) return;

  DBG ("in fribidi_join_arabic");

  fribidi_assert (bidi_types);
  fribidi_assert (embedding_levels);
  fribidi_assert (ar_props);

# if DEBUG
  if UNLIKELY
    (fribidi_debug_status ())
    {
      print_joining_types (embedding_levels, len, ar_props);
    }
# endif    /* DEBUG */

  /* The joining algorithm turned out very very dirty :(.  That's what happens
   * when you follow the standard which has never been implemented closely
   * before.
   */

  /* 8.2 Arabic - Cursive Joining */
  DBG ("Arabic cursive joining");
  {
    /* The following do not need to be initialized as long as joins is
     * initialized to false.  We just do to turn off compiler warnings. */
    register FriBidiStrIndex saved = 0;
    register FriBidiLevel saved_level = FRIBIDI_SENTINEL;
    register fribidi_boolean saved_shapes = false;
    register FriBidiArabicProp saved_joins_following_mask = 0;

    register fribidi_boolean joins = false;
    register FriBidiStrIndex i;

    for (i = 0; i < len; i++)
      if (!FRIBIDI_IS_JOINING_TYPE_G (ar_props[i]))
    {
      register fribidi_boolean disjoin = false;
      register fribidi_boolean shapes = FRIBIDI_ARAB_SHAPES (ar_props[i]);
      register FriBidiLevel level = FRIBIDI_CONSISTENT_LEVEL (i);

      if (joins && !FRIBIDI_LEVELS_MATCH (saved_level, level))
        {
          disjoin = true;
          joins = false;
        }

      if (!FRIBIDI_IS_JOIN_SKIPPED (ar_props[i]))
        {
          register const FriBidiArabicProp joins_preceding_mask =
        FRIBIDI_JOINS_PRECEDING_MASK (level);

          if (!joins)
        {
          if (shapes)
            FRIBIDI_UNSET_BITS (ar_props[i], joins_preceding_mask);
        }
          else if (!FRIBIDI_TEST_BITS (ar_props[i], joins_preceding_mask))
            {
          disjoin = true;
        }
          else
            {
          register FriBidiStrIndex j;
          /* This is a FriBidi extension:  we set joining properties
           * for skipped characters in between, so we can put NSMs on tatweel
           * later if we want.  Useful on console for example.
           */
          for (j = saved + 1; j < i; j++)
            FRIBIDI_SET_BITS (ar_props[j], joins_preceding_mask | saved_joins_following_mask);
        }
        }

      if (disjoin && saved_shapes)
        FRIBIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);

      if (!FRIBIDI_IS_JOIN_SKIPPED (ar_props[i]))
        {
          saved = i;
          saved_level = level;
          saved_shapes = shapes;
          saved_joins_following_mask =
        FRIBIDI_JOINS_FOLLOWING_MASK (level);
          joins =
        FRIBIDI_TEST_BITS (ar_props[i], saved_joins_following_mask);
        }
    }
    if ((joins) && saved_shapes)
      FRIBIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);

  }

# if DEBUG
  if UNLIKELY
    (fribidi_debug_status ())
    {
      print_joining_types (embedding_levels, len, ar_props);
    }
# endif    /* DEBUG */

  DBG ("leaving fribidi_join_arabic");
}

/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-joining.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-joining.h - Arabic joining algorithm
 *
 * $Id: fribidi-joining.h,v 1.3 2004/06/21 21:15:31 behdad Exp $
 * $Author: behdad $
 * $Date: 2004/06/21 21:15:31 $
 * $Revision: 1.3 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining.h,v $
 *
 * Authors:
 *   Behdad Esfahbod, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2004 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _FRIBIDI_JOINING_H
#define _FRIBIDI_JOINING_H

#include "fribidi-common.h"

#include "fribidi-types.h"
#include "fribidi-bidi-types.h"
#include "fribidi-joining-types.h"

#include "fribidi-begindecls.h"

#define fribidi_join_arabic FRIBIDI_NAMESPACE(join_arabic)
/* fribidi_join_arabic - do Arabic joining
 *
 * This function does the Arabic joining algorithm.  Means, given Arabic
 * joining types of the characters in ar_props (don't worry,
 * FriBidiJoiningType can be casted to FriBidiArabicProp automagically), this
 * function modifies this properties to grasp the effect of neighboring
 * characters.  You probably need this information later to do Arabic shaping.
 *
 * This function implements rules R1 to R7 inclusive (all rules) of the Arabic
 * Cursive Joining algorithm of the Unicode standard as available at 
 * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462.  It also
 * interacts correctly with the bidirection algorithm as defined in Section
 * 3.5 Shaping of the Unicode Bidirectional Algorithm available at
 * http://www.unicode.org/reports/tr9/#Shaping.
 *
 * There are a few macros defined in fribidi-joining-types.h for querying the
 * Arabic properties computed by this function.
 */
FRIBIDI_ENTRY void fribidi_join_arabic (
  const FriBidiCharType *bidi_types,    /* input list of bidi types as
                       returned by
                       fribidi_get_bidi_types() */
  const FriBidiStrIndex len,    /* input string length */
  const FriBidiLevel *embedding_levels,    /* input list of embedding
                       levels, as returned by
                       fribidi_get_par_embedding_levels */
  FriBidiArabicProp *ar_props    /* Arabic properties to analyze, initilized by
                   joining types, as returned by
                   fribidi_get_joining_types */
);

#include "fribidi-enddecls.h"

#endif /* !_FRIBIDI_JOINING_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */

 

fribidi-joining-types.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-joining-types.c - character joining types
 *
 * $Id: fribidi-joining-types.c,v 1.5 2006/01/31 03:23:13 behdad Exp $
 * $Author: behdad $
 * $Date: 2006/01/31 03:23:13 $
 * $Revision: 1.5 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining-types.c,v $
 *
 * Authors:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */

#include "common.h"

#include "fribidi-joining-types.h"

#include "joining-types.h"

enum FriBidiJoiningTypeShortEnum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE,
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
  _FRIBIDI_NUM_TYPES
};

#include "joining-type.tab.i"

FRIBIDI_ENTRY FriBidiJoiningType
fribidi_get_joining_type (
  /* input */
  FriBidiChar ch
)
{
  return FRIBIDI_GET_JOINING_TYPE (ch);
}

FRIBIDI_ENTRY void
fribidi_get_joining_types (
  /* input */
  const FriBidiChar *str,
  const FriBidiStrIndex len,
  /* output */
  FriBidiJoiningType *jtypes
)
{
  register FriBidiStrIndex i = len;
  for (; i; i--)
    {
      *jtypes++ = FRIBIDI_GET_JOINING_TYPE (*str);
      str++;
    }
}

FRIBIDI_ENTRY const char *
fribidi_get_joining_type_name (
  /* input */
  FriBidiJoiningType j
)
{
  switch (j)
    {
#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE);
#   include "fribidi-joining-types-list.h"
#   undef _FRIBIDI_ADD_TYPE
    default:
      return "?";
    }
}

#if DEBUG+0

char
fribidi_char_from_joining_type (
  /* input */
  FriBidiJoiningType j,
  fribidi_boolean visual
)
{
  /* switch left and right if on visual run */
  if (visual & ((FRIBIDI_JOINS_RIGHT (j) && !FRIBIDI_JOINS_LEFT (j)) |
        (!FRIBIDI_JOINS_RIGHT (j) && FRIBIDI_JOINS_LEFT (j))))
    j ^= FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT;

#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL)    \
    if (FRIBIDI_IS_JOINING_TYPE_##TYPE(j)) return SYMBOL;
#   include "fribidi-joining-types-list.h"
#   undef _FRIBIDI_ADD_TYPE

  return '?';
}

#endif /* DEBUG */

/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-joining-types.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-joining-types.h - character joining types
 *
 * $Id: fribidi-joining-types.h,v 1.5 2005/11/03 01:39:01 behdad Exp $
 * $Author: behdad $
 * $Date: 2005/11/03 01:39:01 $
 * $Revision: 1.5 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining-types.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _FRIBIDI_JOINING_TYPES_H
#define _FRIBIDI_JOINING_TYPES_H

#include "fribidi-common.h"

#include "fribidi-types.h"

#include "fribidi-begindecls.h"

/* 
 * Define bit masks that joining types are based on, each mask has
 * only one bit set.
 */

#define FRIBIDI_MASK_JOINS_RIGHT    0x01    /* May join to right */
#define FRIBIDI_MASK_JOINS_LEFT        0x02    /* May join to right */
#define FRIBIDI_MASK_ARAB_SHAPES    0x04    /* May Arabic shape */
#define FRIBIDI_MASK_TRANSPARENT    0x08    /* Is transparent */
#define FRIBIDI_MASK_IGNORED        0x10    /* Is ignored */
#define FRIBIDI_MASK_LIGATURED        0x20    /* Is ligatured */

/*
 * Define values for FriBidiJoiningType
 */

/* nUn-joining */
#define FRIBIDI_JOINING_TYPE_U_VAL    ( 0 )

/* Right-joining */
#define FRIBIDI_JOINING_TYPE_R_VAL    \
    ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_ARAB_SHAPES )

/* Dual-joining */
#define FRIBIDI_JOINING_TYPE_D_VAL    \
    ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
    | FRIBIDI_MASK_ARAB_SHAPES )

/* join-Causing */
#define FRIBIDI_JOINING_TYPE_C_VAL    \
    ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT )

/* Left-joining */
#define FRIBIDI_JOINING_TYPE_L_VAL    \
    ( FRIBIDI_MASK_JOINS_LEFT | FRIBIDI_MASK_ARAB_SHAPES )

/* Transparent */
#define FRIBIDI_JOINING_TYPE_T_VAL    \
    ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_ARAB_SHAPES )

/* iGnored */
#define FRIBIDI_JOINING_TYPE_G_VAL    ( FRIBIDI_MASK_IGNORED )


enum _FriBidiJoiningTypeEnum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
    FRIBIDI_JOINING_TYPE_##TYPE = FRIBIDI_JOINING_TYPE_##TYPE##_VAL,
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
  _FRIBIDI_JOINING_TYPE_JUNK    /* Don't use this */
};

#ifdef __FRIBIDI_DOC
typedef enum _FriBidiJoiningTypeEnum FriBidiJoiningType;
#else /* !__FRIBIDI_DOC */
typedef fribidi_uint8 FriBidiJoiningType;
#endif /* !__FRIBIDI_DOC */

/* FriBidiArabicProp is essentially the same type as FriBidiJoiningType, but
 * not limited to the few values returned by fribidi_get_joining_type. */
typedef fribidi_uint8 FriBidiArabicProp;

/*
 * The equivalent of JoiningType values for ArabicProp
 */

/* Primary Arabic Joining Classes (Table 8-2) */

/* nUn-joining */
#define FRIBIDI_IS_JOINING_TYPE_U(p)    \
    ( 0 == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )

/* Right-joining */
#define FRIBIDI_IS_JOINING_TYPE_R(p)    \
    ( FRIBIDI_MASK_JOINS_RIGHT == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )

/* Dual-joining */
#define FRIBIDI_IS_JOINING_TYPE_D(p)    \
    ( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT    \
      | FRIBIDI_MASK_ARAB_SHAPES ) == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT    \
        | FRIBIDI_MASK_ARAB_SHAPES ) ) )

/* join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_C(p)    \
    ( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) == ( (p) & \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT    \
        | FRIBIDI_MASK_ARAB_SHAPES ) ) )

/* Left-joining */
#define FRIBIDI_IS_JOINING_TYPE_L(p)    \
    ( FRIBIDI_MASK_JOINS_LEFT == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )

/* Transparent */
#define FRIBIDI_IS_JOINING_TYPE_T(p)    \
    ( FRIBIDI_MASK_TRANSPARENT == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) )

/* iGnored */
#define FRIBIDI_IS_JOINING_TYPE_G(p)    \
    ( FRIBIDI_MASK_IGNORED == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) )

/* and for Derived Arabic Joining Classes (Table 8-3) */

/* Right join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_RC(p)    \
    ( FRIBIDI_MASK_JOINS_RIGHT == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_RIGHT ) ) )

/* Left join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_LC(p)    \
    ( FRIBIDI_MASK_JOINS_LEFT == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_JOINS_LEFT ) ) )


/*
 * Defining macros for needed queries, It is fully dependent on the 
 * implementation of FriBidiJoiningType.
 */

/* Joins to right: R, D, C? */
#define FRIBIDI_JOINS_RIGHT(p)    ((p) & FRIBIDI_MASK_JOINS_RIGHT)

/* Joins to left: L, D, C? */
#define FRIBIDI_JOINS_LEFT(p)    ((p) & FRIBIDI_MASK_JOINS_LEFT)

/* May shape: R, D, L, T? */
#define FRIBIDI_ARAB_SHAPES(p)    ((p) & FRIBIDI_MASK_ARAB_SHAPES)

/* Is skipped in joining: T, G? */
#define FRIBIDI_IS_JOIN_SKIPPED(p)    \
    ((p) & (FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED))

/* Is base that will be shaped: R, D, L? */
#define FRIBIDI_IS_JOIN_BASE_SHAPES(p)    \
    ( FRIBIDI_MASK_ARAB_SHAPES == ( (p) &    \
        ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED    \
        | FRIBIDI_MASK_ARAB_SHAPES ) ) )

#define FRIBIDI_JOINS_PRECEDING_MASK(level)    \
    (FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_RIGHT    \
                      : FRIBIDI_MASK_JOINS_LEFT)

#define FRIBIDI_JOINS_FOLLOWING_MASK(level)    \
    (FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_LEFT    \
                      : FRIBIDI_MASK_JOINS_RIGHT)

#define FRIBIDI_JOIN_SHAPE(p)    \
    ((p) & ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ))

/* Functions finally */


#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type)
/* fribidi_get_joining_type - get character joining type
 *
 * This function returns the joining type of a character as defined in Table
 * 8-2 Primary Arabic Joining Classes of the Unicode standard available at
 * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462, using data
 * provided in file ArabicShaping.txt and UnicodeData.txt of the Unicode
 * Character Database available at
 * http://www.unicode.org/Public/UNIDATA/ArabicShaping.txt and
 * http://www.unicode.org/Public/UNIDATA/UnicodeData.txt. 
 *
 * There are a few macros defined in fribidi-joining-types.h for querying a
 * joining type.
 */
FRIBIDI_ENTRY FriBidiJoiningType
fribidi_get_joining_type (
  FriBidiChar ch        /* input character */
) FRIBIDI_GNUC_CONST;

#define fribidi_get_joining_types FRIBIDI_NAMESPACE(get_joining_types)
/* fribidi_get_joining_types - get joining types for an string of characters
 *
 * This function finds the joining types of an string of characters.  See
 * fribidi_get_joining_type for more information about the joining types
 * returned by this function.
 */
     FRIBIDI_ENTRY void fribidi_get_joining_types (
  const FriBidiChar *str,    /* input string */
  const FriBidiStrIndex len,    /* input string length */
  FriBidiJoiningType *jtypes    /* output joining types */
);

#define fribidi_get_joining_type_name FRIBIDI_NAMESPACE(get_joining_type_name)
/* fribidi_get_joining_type_name - get joining type name
 *
 * This function returns the joining type name of a joining type.  The
 * returned string is a static string and should not be freed.
 *
 * The type names are the same as ones defined in Table 8-2  Primary Arabic
 * Joining Classes of the Unicode standard available at
 * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462.
 */
     FRIBIDI_ENTRY const char *fribidi_get_joining_type_name (
  FriBidiJoiningType j        /* input joining type */
) FRIBIDI_GNUC_CONST;

#include "fribidi-enddecls.h"

#endif /* !_FRIBIDI_JOINING_TYPES_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-joining-types-list.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#ifndef __FRIBIDI_DOC
/* FriBidi
 * fribidi-joining-types-list.h - list of joining types
 *
 * $Id: fribidi-joining-types-list.h,v 1.2 2004/06/15 11:52:02 behdad Exp $
 * $Author: behdad $
 * $Date: 2004/06/15 11:52:02 $
 * $Revision: 1.2 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining-types-list.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * Copyright (C) 2004 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */
/* *INDENT-OFF* */
#endif /* !__FRIBIDI_DOC */
#ifndef _FRIBIDI_ADD_TYPE
# define _FRIBIDI_ADD_TYPE(x,y)
#endif

_FRIBIDI_ADD_TYPE (U, '|')    /* nUn-joining, e.g. Full Stop */
_FRIBIDI_ADD_TYPE (R, '<')    /* Right-joining, e.g. Arabic Letter Dal */
_FRIBIDI_ADD_TYPE (D, '+')    /* Dual-joining, e.g. Arabic Letter Ain */
_FRIBIDI_ADD_TYPE (C, '-')    /* join-Causing, e.g. Tatweel, ZWJ */
_FRIBIDI_ADD_TYPE (T, '^')    /* Transparent, e.g. Arabic Fatha */
_FRIBIDI_ADD_TYPE (L, '>')    /* Left-joining, i.e. fictional */
_FRIBIDI_ADD_TYPE (G, '~')    /* iGnored, e.g. LRE, RLE, ZWNBSP */

#ifndef __FRIBIDI_DOC
/* *INDENT-ON* */
#endif /* !__FRIBIDI_DOC */
 

fribidi-mem.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* FriBidi
 * fribidi-mem.c - memory manipulation routines
 *
 * $Id: fribidi-mem.c,v 1.8 2006/01/31 03:23:13 behdad Exp $
 * $Author: behdad $
 * $Date: 2006/01/31 03:23:13 $
 * $Revision: 1.8 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-mem.c,v $
 *
 * Authors:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 * 
 * For licensing issues, contact <license@farsiweb.info>.
 */

#include "common.h"

#include "mem.h"

#if FRIBIDI_USE_GLIB+0
#else
#if USE_SIMPLE_MALLOC+0
#else

struct _FriBidiMemChunk
{
  int atom_size;
  int area_size;
  int empty_size;
  void *chunk;
};

FriBidiMemChunk *
fribidi_mem_chunk_new (
  /* input */
  const char *name,
  int atom_size,
  unsigned long area_size,
  int alloc_type
)
{
  register FriBidiMemChunk *m;

  fribidi_assert (area_size >= atom_size * 8);

  m = (FriBidiMemChunk *) fribidi_malloc (sizeof (FriBidiMemChunk));
  if LIKELY
    (m)
    {
      m->atom_size = atom_size;
      m->area_size = area_size;
      m->empty_size = 0;
      m->chunk = NULL;
    }

  return m;
}

void *
fribidi_mem_chunk_alloc (
  /* input */
  FriBidiMemChunk *mem_chunk
)
{
  fribidi_assert (mem_chunk);

  if UNLIKELY
    (mem_chunk->empty_size < mem_chunk->atom_size)
    {
      register void *chunk = fribidi_malloc (mem_chunk->area_size);
      if LIKELY
    (chunk)
    {
      if (mem_chunk->chunk)
        *(void **) chunk =
          (char *) mem_chunk->chunk + mem_chunk->empty_size -
          mem_chunk->area_size;
      chunk = (char *) chunk + mem_chunk->atom_size;
      mem_chunk->chunk = chunk;
      mem_chunk->empty_size = mem_chunk->area_size - mem_chunk->atom_size;
    }
      else
    return NULL;
    }

  {
    register void *m = mem_chunk->chunk;
    mem_chunk->chunk = (char *) mem_chunk->chunk + mem_chunk->atom_size;
    mem_chunk->empty_size -= mem_chunk->atom_size;

    return m;
  }
}

void
fribidi_mem_chunk_destroy (
  /* input */
  FriBidiMemChunk *mem_chunk
)
{
  register void *chunk;

  fribidi_assert (mem_chunk);

  chunk =
    (char *) mem_chunk->chunk + mem_chunk->empty_size - mem_chunk->area_size;
  while LIKELY
    (chunk)
    {
      register void *tofree = chunk;
      chunk = *(void **) chunk;
      fribidi_free (tofree);
    }
  fribidi_free (mem_chunk);
}

#endif /* !USE_SIMPLE_MALLOC */
#endif /* !FRIBIDI_USE_GLIB */

/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */
 

fribidi-mirroring.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* fribidi-mirroring.c - get mirrored character
 *
 * Copyright (C) 2004  Sharif FarsiWeb, Inc
 * Copyright (C) 2001, 2002, 2004  Behdad Esfahbod
 * Copyright (C) 1999, 2000  Dov Grobgeld
 *
 * This file is part of GNU FriBidi.
 * 
 * GNU FriBidi is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 * 
 * GNU FriBidi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * 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@farsiweb.info> or write to
 * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
 */
/* $Id: fribidi-mirroring.c,v 1.15 2005/11/03 01:39:01 behdad Exp $
 * $Author: behdad $
 * $Date: 2005/11/03 01:39:01 $
 * $Revision: 1.15 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-mirroring.c,v $
 *
 * Author(s):
 *   Behdad Esfahbod, 2001, 2002, 2004
 *   Dov Grobgeld, 1999, 2000
 */

#include "common.h"

#include "fribidi-mirroring.h"

#include "mirroring.tab.i"

FRIBIDI_ENTRY fribidi_boolean
fribidi_get_mirror_char (
  /* input */
  FriBidiChar ch,
  /* output */
  FriBidiChar *mirrored_ch
)
{
  register FriBidiChar result;
  result = FRIBIDI_GET_MIRRORING (ch);
  if (mirrored_ch)
    *mirrored_ch = result;
  return ch != result ? true : false;
}


FRIBIDI_ENTRY void
fribidi_shape_mirroring (
  /* input */
  const FriBidiLevel *embedding_levels,
  const FriBidiStrIndex len,
  /* input and output */
  FriBidiChar *str
)
{
  register FriBidiStrIndex i;

  DBG ("in fribidi_shape_mirroring");

  if UNLIKELY
    (len == 0 || !str) return;

  fribidi_assert (embedding_levels);

  /* 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_levels[i]))
      {
    FriBidiChar mirrored_ch;

    if (fribidi_get_mirror_char (str[i], &mirrored_ch))
      str[i] = mirrored_ch;
      }
}

/* Editor directions:
 * Local Variables:
 *   mode: c
 *   c-basic-offset: 2
 *   indent-tabs-mode: t
 *   tab-width: 8
 * End:
 * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
 */
 

fribidi-mirroring.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* fribidi-mirroring.h - get mirrored character
 *
 * Copyright (C) 2004  Sharif FarsiWeb, Inc
 * Copyright (C) 2001, 2002, 2004  Behdad Esfahbod
 * Copyright (C) 1999, 2000  Dov Grobgeld
 * 
 * This file is part of GNU FriBidi.
 * 
 * GNU FriBidi is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 * 
 * GNU FriBidi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * 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@farsiweb.info> or write to
 * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
 */
/* $Id: fribidi-mirroring.h,v 1.10 2004/09/28 07:58:57 behdad Exp $
 * $Author: behdad $
 * $Date: 2004/09/28 07:58:57 $
 * $Revision: 1.10 $
 * $Source: /cvs/fribidi/fribidi2/lib/fribidi-mirroring.h,v $
 *
 * Author(s):
 *   Behdad Esfahbod, 2001, 2002, 2004
 *   Dov Grobgeld, 1999, 2000
 */
#ifndef _FRIBIDI_MIRRORING_H
#define _FRIBIDI_MIRRORING_H

#include "fribidi-common.h"

#include "fribidi-types.h"
#include "fribidi-bidi-types.h"

#include "fribidi-begindecls.h"

#define fribidi_get_mirror_char FRIBIDI_NAMESPACE(get_mirror_char)
/* fribidi_get_mirror_char - get mirrored character
 *
 * This function finds the mirrored equivalent of a character as defined in
 * the file BidiMirroring.txt of the Unicode Character Database available at
 * http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt.
 *
 * If  the input character is a declared as a mirroring character in the
 * Unicode standard and has a mirrored equivalent.  The matching mirrored
 * character is put in the output, otherwise the input character itself is
 * put.
 *
 * Returns: if the character has a mirroring equivalent or not.
 */
FRIBIDI_ENTRY fribidi_boolean fribidi_get_mirror_char (
  FriBidiChar ch,        /* input character */
  FriBidiChar *mirrored_ch    /* output mirrored character */
);

#define fribidi_shape_mirroring FRIBIDI_NAMESPACE(shape_mirroring)
/* fribidi_shape_mirroring - do mirroring shaping
 *
 * This functions replaces mirroring characters on right-to-left embeddings in
 * string with their mirrored equivalent as returned by
 * fribidi_get_mirror_char().
 *
 * This function implements rule L4 of the Unicode Bidirectional Algorithm
 * available at http://www.unicode.org/reports/tr9/#L4.
 */
FRIBIDI_ENTRY void fribidi_shape_mirroring (
  const FriBidiLevel *embedding_levels,    /* input list of embedding
                       levels, as returned by
                       fribidi_get_par_embedding_levels */
  const FriBidiStrIndex len,    /* input string length */
  FriBidiChar *str        /* string to shape */
);

#include "fribidi-enddecls.h"

#endif /* !_FRIBIDI_MIRRORING_H */
/* Editor directions:
 * Local Variables:
 *   mode: c
 *   c-basic-offset: 2
 *   indent-tabs-mode: t
 *   tab-width: 8
 * End:
 * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
 */
 

  • 13
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值