| fribidi.h | | fribidi.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
| * Boston, MA 02111-1307, USA | | * Boston, MA 02111-1307, USA | |
| * | | * | |
| * For licensing issues, contact <dov@imagic.weizmann.ac.il> and | | * For licensing issues, contact <dov@imagic.weizmann.ac.il> and | |
| * <fwpg@sharif.edu>. | | * <fwpg@sharif.edu>. | |
| */ | | */ | |
| | | | |
| #ifndef FRIBIDI_H | | #ifndef FRIBIDI_H | |
| #define FRIBIDI_H | | #define FRIBIDI_H | |
| | | | |
|
| | | #ifndef NULL | |
| | | #define NULL 0 | |
| | | #endif | |
| | | | |
| #include "fribidi_config.h" | | #include "fribidi_config.h" | |
| #include "fribidi_unicode.h" | | #include "fribidi_unicode.h" | |
|
| #include "fribidi_mem.h" | | | |
| #include "fribidi_types.h" | | #include "fribidi_types.h" | |
| #ifndef FRIBIDI_NO_CHARSETS | | #ifndef FRIBIDI_NO_CHARSETS | |
| #include "fribidi_char_sets.h" | | #include "fribidi_char_sets.h" | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
|
| fribidi_boolean fribidi_log2vis ( /* input */ | | FRIBIDI_API fribidi_boolean fribidi_log2vis ( /* input */ | |
| FriBidiChar *str, FriBidiStrIndex len, | | FriBidiChar *str, | |
| FriBidiCharType *pbase_dirs, | | FriBidiStrIndex len, | |
| /* output */ | | FriBidiCharType *pbase_dirs, | |
| FriBidiChar *visual_str, | | /* output */ | |
| FriBidiStrIndex *position_L_to_V_list, | | FriBidiChar *visual_str, | |
| FriBidiStrIndex *position_V_to_L_list, | | FriBidiStrIndex | |
| FriBidiLevel *embedding_level_list); | | *position_L_to_V_list, | |
| | | FriBidiStrIndex | |
| | | *position_V_to_L_list, | |
| | | FriBidiLevel | |
| | | *embedding_level_list); | |
| | | | |
|
| fribidi_boolean fribidi_log2vis_get_embedding_levels ( /* input */ | | FRIBIDI_API fribidi_boolean fribidi_log2vis_get_embedding_levels ( /* i | |
| FriBidiChar *str, | | nput */ | |
| FriBidiStrIndex len | | FriBidi | |
| , | | Char | |
| FriBidiCharType | | *str, | |
| *pbase_dir, | | FriBidi | |
| /* output */ | | StrIndex | |
| FriBidiLevel | | len, | |
| *embedding_level_li | | FriBidi | |
| st); | | CharType | |
| | | *pbase_ | |
| | | dir, | |
| | | /* outp | |
| | | ut */ | |
| | | FriBidi | |
| | | Level | |
| | | *embedd | |
| | | ing_level_list); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_remove_bidi_marks() removes bidirectional marks, and returns | | * fribidi_remove_bidi_marks() removes bidirectional marks, and returns | |
| * the new length, also updates each of other inputs if not NULL. | | * the new length, also updates each of other inputs if not NULL. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| FriBidiStrIndex fribidi_remove_bidi_marks (FriBidiChar *str, | | FRIBIDI_API FriBidiStrIndex fribidi_remove_bidi_marks (FriBidiChar *str, | |
| FriBidiStrIndex length, | | FriBidiStrIndex | |
| FriBidiStrIndex | | length, | |
| *position_to_this_list, | | FriBidiStrIndex | |
| FriBidiStrIndex | | *position_to_this_l | |
| *position_from_this_list, | | ist, | |
| FriBidiLevel | | FriBidiStrIndex | |
| *embedding_level_list); | | *position_from_this | |
| | | _list, | |
| | | FriBidiLevel | |
| | | *embedding_level_li | |
| | | st); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_get_type() returns bidi type of a character. | | * fribidi_get_type() returns bidi type of a character. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| FriBidiCharType fribidi_get_type_internal (FriBidiChar uch); | | FRIBIDI_API FriBidiCharType fribidi_get_type (FriBidiChar uch); | |
| | | | |
| #define fribidi_get_type(uch) fribidi_get_type_internal(uch) | | | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_get_types() returns bidi type of a string. | | * fribidi_get_types() returns bidi type of a string. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_get_types ( /* input */ | | FRIBIDI_API void fribidi_get_types ( /* input */ | |
| FriBidiChar *str, FriBidiStrIndex len, | | FriBidiChar *str, | |
| /* output */ | | FriBidiStrIndex len, | |
| FriBidiCharType *type); | | /* output */ | |
| | | FriBidiCharType *type); | |
| | | | |
| | | /*====================================================================== | |
| | | * fribidi_get_mirror_char() returns the mirrored character, if any. | |
| | | *----------------------------------------------------------------------*/ | |
| | | FRIBIDI_API fribidi_boolean fribidi_get_mirror_char ( | |
| | | /* Input */ | |
| | | FriBidiChar ch, | |
| | | /* Output */ | |
| | | FriBidiChar | |
| | | *mirrored_ch); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_get_mirror_char() returns the mirrored character, if input | | * fribidi_get_mirror_char() returns the mirrored character, if input | |
| * character has a mirror, or the input itself. | | * character has a mirror, or the input itself. | |
| * if mirrored_ch is NULL, just returns if character has a mirror or not. | | * if mirrored_ch is NULL, just returns if character has a mirror or not. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| fribidi_boolean fribidi_get_mirror_char ( /* Input */ | | FRIBIDI_API fribidi_boolean fribidi_get_mirror_char ( /* Input */ | |
| FriBidiChar ch, | | FriBidiChar ch, | |
| /* Output */ | | /* Output */ | |
| FriBidiChar *mirrored_ch); | | FriBidiChar | |
| | | *mirrored_ch); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_mirroring_status() returns whether mirroring is on or off, | | * fribidi_mirroring_status() returns whether mirroring is on or off, | |
| * default is on. | | * default is on. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| fribidi_boolean fribidi_mirroring_status (void); | | FRIBIDI_API fribidi_boolean fribidi_mirroring_status (void); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_set_mirroring() sets mirroring on or off. | | * fribidi_set_mirroring() sets mirroring on or off. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_set_mirroring (fribidi_boolean mirror); | | FRIBIDI_API void fribidi_set_mirroring (fribidi_boolean mirror); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_reorder_nsm_status() returns whether reordering of NSM | | * fribidi_reorder_nsm_status() returns whether reordering of NSM | |
| * sequences is on or off, default is off. | | * sequences is on or off, default is off. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| fribidi_boolean fribidi_reorder_nsm_status (void); | | FRIBIDI_API fribidi_boolean fribidi_reorder_nsm_status (void); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_set_reorder_nsm() sets reordering of NSM characters on or off. | | * fribidi_set_reorder_nsm() sets reordering of NSM characters on or off. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_set_reorder_nsm (fribidi_boolean); | | FRIBIDI_API void fribidi_set_reorder_nsm (fribidi_boolean); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_set_debug() turn on or off debugging, default is off, return | | * fribidi_set_debug() turn on or off debugging, default is off, return | |
| * false is fribidi is not compiled with debug enabled. | | * false is fribidi is not compiled with debug enabled. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| fribidi_boolean fribidi_set_debug (fribidi_boolean debug); | | FRIBIDI_API fribidi_boolean fribidi_set_debug (fribidi_boolean debug); | |
| | | | |
| /* fribidi_utils.c */ | | /* fribidi_utils.c */ | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_find_string_changes() finds the bounding box of the section | | * fribidi_find_string_changes() finds the bounding box of the section | |
| * of characters that need redrawing. It returns the start and the | | * of characters that need redrawing. It returns the start and the | |
| * length of the section in the new string that needs redrawing. | | * length of the section in the new string that needs redrawing. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_find_string_changes ( /* input */ | | FRIBIDI_API void fribidi_find_string_changes ( /* input */ | |
| FriBidiChar *old_str, | | FriBidiChar *old_str, | |
| FriBidiStrIndex old_len, | | FriBidiStrIndex old_len, | |
| FriBidiChar *new_str, | | FriBidiChar *new_str, | |
| FriBidiStrIndex new_len, | | FriBidiStrIndex new_len, | |
| /* output */ | | /* output */ | |
| FriBidiStrIndex *change_start, | | FriBidiStrIndex | |
| FriBidiStrIndex *change_len); | | *change_start, | |
| | | FriBidiStrIndex *change_len | |
| | | ); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * The find_visual_ranges() function is used to convert between a | | * The find_visual_ranges() function is used to convert between a | |
| * continous span in either logical or visual space to a one, two or | | * continous span in either logical or visual space to a one, two or | |
| * three discontinous spans in the other space. The function outputs | | * three discontinous spans in the other space. The function outputs | |
| * the number of ranges needed to display the mapped range as | | * the number of ranges needed to display the mapped range as | |
| * well as the resolved ranges. | | * well as the resolved ranges. | |
| * | | * | |
| * The variable is_v2l_map indicates whether the position map is | | * The variable is_v2l_map indicates whether the position map is | |
| * is in the direction of visual-to-logical. This information is | | * is in the direction of visual-to-logical. This information is | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 190 | |
| * FriBidiStrIndex sel_span[2] = {10,45}; | | * FriBidiStrIndex sel_span[2] = {10,45}; | |
| * | | * | |
| * fribidi_map_range(sel_span, | | * fribidi_map_range(sel_span, | |
| * TRUE, | | * TRUE, | |
| * length, | | * length, | |
| * vis2log_map, | | * vis2log_map, | |
| * embedding_levels, | | * embedding_levels, | |
| * // output | | * // output | |
| * &num_vis_ranges, *vis_ranges); | | * &num_vis_ranges, *vis_ranges); | |
| **----------------------------------------------------------------------*/ | | **----------------------------------------------------------------------*/ | |
|
| void fribidi_map_range (FriBidiStrIndex span[2], FriBidiStrIndex len, | | FRIBIDI_API void fribidi_map_range (FriBidiStrIndex span[2], | |
| fribidi_boolean is_v2l_map, | | FriBidiStrIndex len, | |
| FriBidiStrIndex *position_map, | | fribidi_boolean is_v2l_map, | |
| FriBidiLevel *embedding_level_list, | | FriBidiStrIndex *position_map, | |
| /* output */ | | FriBidiLevel *embedding_level_list, | |
| int *num_mapped_spans, FriBidiStrIndex spans[3][2] | | /* output */ | |
| ); | | int *num_mapped_spans, | |
| | | FriBidiStrIndex spans[3][2]); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_is_char_rtl() answers the question whether a character | | * fribidi_is_char_rtl() answers the question whether a character | |
| * was resolved in the rtl direction. This simply involves asking | | * was resolved in the rtl direction. This simply involves asking | |
| * if the embedding level for the character is odd. | | * if the embedding level for the character is odd. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| fribidi_boolean fribidi_is_char_rtl (FriBidiLevel *embedding_level_list, | | FRIBIDI_API fribidi_boolean fribidi_is_char_rtl (FriBidiLevel | |
| FriBidiCharType base_dir, | | *embedding_level_list, | |
| FriBidiStrIndex idx); | | FriBidiCharType base_dir, | |
| | | FriBidiStrIndex idx); | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_xpos_resolve() does the complicated translation of | | * fribidi_xpos_resolve() does the complicated translation of | |
| * an x-coordinate, e.g. as received through a mouse press event, | | * an x-coordinate, e.g. as received through a mouse press event, | |
| * to the logical and the visual position the xcoordinate is closest | | * to the logical and the visual position the xcoordinate is closest | |
| * to. It will also resolve the direction of the cursor according | | * to. It will also resolve the direction of the cursor according | |
| * to the embedding level of the closest character. | | * to the embedding level of the closest character. | |
| * | | * | |
| * It does this through the following logics: | | * It does this through the following logics: | |
| * Here are the different possibilities: | | * Here are the different possibilities: | |
| | | | |
| skipping to change at line 233 | | skipping to change at line 257 | |
| * at position x_pos is rtl. | | * at position x_pos is rtl. | |
| * res_attach_before Whether the x_pos is cutting the bounding | | * res_attach_before Whether the x_pos is cutting the bounding | |
| * box in such a way that the visual cursor should be | | * box in such a way that the visual cursor should be | |
| * be positioned before the following logical character. | | * be positioned before the following logical character. | |
| * Note that in the bidi context, the positions "after | | * Note that in the bidi context, the positions "after | |
| * a logical character" and "before the following logical | | * a logical character" and "before the following logical | |
| * character" is not necessarily the same. If x_pos is | | * character" is not necessarily the same. If x_pos is | |
| * beyond the end of the line, res_attach_before is true. | | * beyond the end of the line, res_attach_before is true. | |
| * | | * | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_xpos_resolve (int x_pos, int x_offset, | | FRIBIDI_API void fribidi_xpos_resolve (int x_pos, | |
| FriBidiStrIndex len, | | int x_offset, | |
| FriBidiLevel *embedding_level_list, | | FriBidiStrIndex len, | |
| FriBidiCharType base_dir, | | FriBidiLevel *embedding_level_list, | |
| FriBidiStrIndex *vis2log, int *char_widths, | | FriBidiCharType base_dir, | |
| /* output */ | | FriBidiStrIndex *vis2log, | |
| FriBidiStrIndex *res_log_pos, | | int *char_widths, | |
| FriBidiStrIndex *res_vis_pos, | | /* output */ | |
| int *res_cursor_x_pos, | | FriBidiStrIndex *res_log_pos, | |
| fribidi_boolean * res_cursor_dir_is_rtl, | | FriBidiStrIndex *res_vis_pos, | |
| fribidi_boolean * res_attach_before); | | int *res_cursor_x_pos, | |
| | | fribidi_boolean | |
| | | *res_cursor_dir_is_rtl, | |
| | | fribidi_boolean *res_attach_before) | |
| | | ; | |
| | | | |
| /*====================================================================== | | /*====================================================================== | |
| * fribidi_runs_log2vis takes a list of logical runs and returns a | | * fribidi_runs_log2vis takes a list of logical runs and returns a | |
| * a list of visual runs. A run is defined as a sequence that has | | * a list of visual runs. A run is defined as a sequence that has | |
| * the same attributes. | | * the same attributes. | |
| *----------------------------------------------------------------------*/ | | *----------------------------------------------------------------------*/ | |
|
| void fribidi_runs_log2vis ( /* input */ | | FRIBIDI_API void fribidi_runs_log2vis ( /* input */ | |
| FriBidiList *logical_runs, /* List of F | | FriBidiList *logical_runs, /* L | |
| riBidiRunType */ | | ist of FriBidiRunType */ | |
| FriBidiStrIndex len, FriBidiStrIndex *log2vis, | | | |
| FriBidiCharType base_dir, | | FriBidiStrIndex len, | |
| /* output */ | | FriBidiStrIndex *log2vis, | |
| FriBidiList **visual_runs); | | FriBidiCharType base_dir, | |
| | | /* output */ | |
| | | FriBidiList **visual_runs); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* FRIBIDI_H */ | | #endif /* FRIBIDI_H */ | |
| | | | |
End of changes. 18 change blocks. |
| 79 lines changed or deleted | | 118 lines changed or added | |
|
| fribidi_char_sets.h | | fribidi_char_sets.h | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| #include "fribidi_char_sets_cp1256.h" | | #include "fribidi_char_sets_cp1256.h" | |
| #include "fribidi_char_sets_isiri_3342.h" | | #include "fribidi_char_sets_isiri_3342.h" | |
| | | | |
| /* The following enum members are going to be used as array indices, | | /* The following enum members are going to be used as array indices, | |
| so they must be numbered from 0, and with the fixed order, | | so they must be numbered from 0, and with the fixed order, | |
| FRIBIDI_CHARSET_DEFAULT is the one that when a charset leaves it's | | FRIBIDI_CHARSET_DEFAULT is the one that when a charset leaves it's | |
| state with fribidi_charset_leave(), it gets into DEFAULT mode, | | state with fribidi_charset_leave(), it gets into DEFAULT mode, | |
| so it must have no initialization. */ | | so it must have no initialization. */ | |
| typedef enum | | typedef enum | |
| { | | { | |
|
| FRIBIDI_CHARSET_NOT_FOUND, | | FRIBIDI_CHAR_SET_NOT_FOUND, | |
| FRIBIDI_CHARSET_UTF8, | | #define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_S | |
| FRIBIDI_CHARSET_CAP_RTL, | | ET, | |
| FRIBIDI_CHARSET_ISO8859_6, | | #include "fribidi_char_sets.i" | |
| FRIBIDI_CHARSET_ISO8859_8, | | #undef _FRIBIDI_ADD_CHAR_SET | |
| FRIBIDI_CHARSET_CP1255, | | | |
| FRIBIDI_CHARSET_CP1256, | | | |
| FRIBIDI_CHARSET_ISIRI_3342, | | | |
| | | | |
| FRIBIDI_CHAR_SETS_NUM_PLUS_ONE, | | FRIBIDI_CHAR_SETS_NUM_PLUS_ONE, | |
| | | | |
|
| FRIBIDI_CHARSET_DEFAULT = FRIBIDI_CHARSET_UTF8 | | FRIBIDI_CHAR_SET_DEFAULT = FRIBIDI_CHAR_SET_UTF8 | |
| } | | } | |
| FriBidiCharSet; | | FriBidiCharSet; | |
| | | | |
| #define FRIBIDI_CHAR_SETS_NUM (FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1) | | #define FRIBIDI_CHAR_SETS_NUM (FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1) | |
| | | | |
| /* Convert the character string "s" in charset "char_set" to unicode | | /* Convert the character string "s" in charset "char_set" to unicode | |
| string "us" and return it's length. */ | | string "us" and return it's length. */ | |
|
| int fribidi_charset_to_unicode (FriBidiCharSet char_set, char *s, | | FRIBIDI_API int fribidi_charset_to_unicode (FriBidiCharSet char_set, | |
| int length, | | char *s, int length, | |
| /* output */ | | /* output */ | |
| FriBidiChar *us); | | FriBidiChar *us); | |
| | | | |
| /* Convert the unicode string "us" with length "length" to character | | /* Convert the unicode string "us" with length "length" to character | |
| string "s" in charset "char_set" and return it's length. */ | | string "s" in charset "char_set" and return it's length. */ | |
|
| int fribidi_unicode_to_charset (FriBidiCharSet char_set, FriBidiChar *us, | | FRIBIDI_API int fribidi_unicode_to_charset (FriBidiCharSet char_set, | |
| int length, | | FriBidiChar *us, int length, | |
| /* output */ | | /* output */ | |
| char *s); | | char *s); | |
| | | | |
| /* Return the string containing the name of the charset. */ | | /* Return the string containing the name of the charset. */ | |
|
| char *fribidi_char_set_name (FriBidiCharSet char_set); | | FRIBIDI_API char *fribidi_char_set_name (FriBidiCharSet char_set); | |
| | | | |
| /* Return the string containing the title (name with a short description) | | /* Return the string containing the title (name with a short description) | |
| of the charset. */ | | of the charset. */ | |
|
| char *fribidi_char_set_title (FriBidiCharSet char_set); | | FRIBIDI_API char *fribidi_char_set_title (FriBidiCharSet char_set); | |
| | | | |
| /* Return the string containing a descreption about the charset, if any. */ | | /* Return the string containing a descreption about the charset, if any. */ | |
|
| char *fribidi_char_set_desc (FriBidiCharSet char_set); | | FRIBIDI_API char *fribidi_char_set_desc (FriBidiCharSet char_set); | |
| | | | |
| /* Some charsets like CapRTL may need to change some fribidis tables, by | | /* Some charsets like CapRTL may need to change some fribidis tables, by | |
| calling this function, they can do this changes. */ | | calling this function, they can do this changes. */ | |
|
| fribidi_boolean fribidi_char_set_enter (FriBidiCharSet char_set); | | FRIBIDI_API fribidi_boolean fribidi_char_set_enter (FriBidiCharSet | |
| | | char_set); | |
| | | | |
| /* Some charsets like CapRTL may need to change some fribidis tables, by | | /* Some charsets like CapRTL may need to change some fribidis tables, by | |
| calling this function, they can undo their changes, perhaps to enter | | calling this function, they can undo their changes, perhaps to enter | |
| another mode. */ | | another mode. */ | |
|
| fribidi_boolean fribidi_char_set_leave (FriBidiCharSet char_set); | | FRIBIDI_API fribidi_boolean fribidi_char_set_leave (FriBidiCharSet | |
| | | char_set); | |
| | | | |
| /* Return the charset which name is "s". */ | | /* Return the charset which name is "s". */ | |
|
| FriBidiCharSet fribidi_parse_charset (char *s); | | FRIBIDI_API FriBidiCharSet fribidi_parse_charset (char *s); | |
| | | | |
| #ifdef FRIBIDI_INTERFACE_1 | | #ifdef FRIBIDI_INTERFACE_1 | |
| /* Interface version 1, deprecated, just for compatibility. */ | | /* Interface version 1, deprecated, just for compatibility. */ | |
| | | | |
|
| int fribidi_charset_to_unicode_1 (FriBidiCharSet char_set, char *s, | | FRIBIDI_API int fribidi_charset_to_unicode_1 (FriBidiCharSet char_set, | |
| /* output */ | | char *s, | |
| FriBidiChar *us); | | /* output */ | |
| | | FriBidiChar *us); | |
| #define fribidi_charset_to_unicode fribidi_charset_to_unicode_1 | | #define fribidi_charset_to_unicode fribidi_charset_to_unicode_1 | |
| | | | |
| /* Also old character sets. */ | | /* Also old character sets. */ | |
| #define fribidi_utf8_to_unicode fribidi_utf8_to_unicode_1 | | #define fribidi_utf8_to_unicode fribidi_utf8_to_unicode_1 | |
| #define fribidi_cap_rtl_to_unicode fribidi_cap_rtl_to_unicode_1 | | #define fribidi_cap_rtl_to_unicode fribidi_cap_rtl_to_unicode_1 | |
| #define fribidi_iso8859_6_to_unicode fribidi_iso8859_6_to_unicode_1 | | #define fribidi_iso8859_6_to_unicode fribidi_iso8859_6_to_unicode_1 | |
| #define fribidi_iso8859_8_to_unicode fribidi_iso8859_8_to_unicode_1 | | #define fribidi_iso8859_8_to_unicode fribidi_iso8859_8_to_unicode_1 | |
| #define fribidi_cp1255_to_unicode fribidi_cp1255_to_unicode_1 | | #define fribidi_cp1255_to_unicode fribidi_cp1255_to_unicode_1 | |
| #define fribidi_cp1256_to_unicode fribidi_cp1256_to_unicode_1 | | #define fribidi_cp1256_to_unicode fribidi_cp1256_to_unicode_1 | |
| #define fribidi_isiri_3342_to_unicode fribidi_isiri_3342_to_unicode_1 | | #define fribidi_isiri_3342_to_unicode fribidi_isiri_3342_to_unicode_1 | |
| | | | |
End of changes. 11 change blocks. |
| 26 lines changed or deleted | | 26 lines changed or added | |
|
| fribidi_mem.h | | fribidi_mem.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| * along with this library, in a file named COPYING; if not, write to the | | * along with this library, in a file named COPYING; if not, write to the | |
| * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
| * Boston, MA 02111-1307, USA | | * Boston, MA 02111-1307, USA | |
| * | | * | |
| * For licensing issues, contact <fwpg@sharif.edu>. | | * For licensing issues, contact <fwpg@sharif.edu>. | |
| */ | | */ | |
| | | | |
| #ifndef FRIBIDI_MEM_H | | #ifndef FRIBIDI_MEM_H | |
| #define FRIBIDI_MEM_H | | #define FRIBIDI_MEM_H | |
| | | | |
|
| #include <stdlib.h> | | | |
| | | | |
| #include "fribidi_config.h" | | #include "fribidi_config.h" | |
|
| | | #include "fribidi_types.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
|
| #define FRIBIDI_INT8 char | | | |
| #define FRIBIDI_INT16 short | | | |
| #define FRIBIDI_INT32 long | | | |
| #define FRIBIDI_INT int | | | |
| | | | |
| typedef int fribidi_boolean; | | | |
| | | | |
| typedef signed FRIBIDI_INT8 fribidi_int8; | | | |
| typedef unsigned FRIBIDI_INT8 fribidi_uint8; | | | |
| typedef signed FRIBIDI_INT16 fribidi_int16; | | | |
| typedef unsigned FRIBIDI_INT16 fribidi_uint16; | | | |
| typedef signed FRIBIDI_INT32 fribidi_int32; | | | |
| typedef unsigned FRIBIDI_INT32 fribidi_uint32; | | | |
| typedef signed FRIBIDI_INT fribidi_int; | | | |
| typedef unsigned FRIBIDI_INT fribidi_uint; | | | |
| | | | |
| #define FRIBIDI_TRUE 1 | | | |
| #define FRIBIDI_FALSE 0 | | | |
| | | | |
| #ifndef TRUE | | | |
| #define TRUE FRIBIDI_TRUE | | | |
| #endif | | | |
| #ifndef FALSE | | | |
| #define FALSE FRIBIDI_FALSE | | | |
| #endif | | | |
| | | | |
| typedef struct _FriBidiList FriBidiList; | | | |
| struct _FriBidiList | | | |
| { | | | |
| void *data; | | | |
| FriBidiList *next; | | | |
| FriBidiList *prev; | | | |
| }; | | | |
| | | | |
| FriBidiList *fribidi_list_append (FriBidiList *list, void *data); | | FriBidiList *fribidi_list_append (FriBidiList *list, void *data); | |
| | | | |
| typedef struct _FriBidiMemChunk FriBidiMemChunk; | | typedef struct _FriBidiMemChunk FriBidiMemChunk; | |
| | | | |
| #define FRIBIDI_ALLOC_ONLY 1 | | #define FRIBIDI_ALLOC_ONLY 1 | |
| #define FRIBIDI_ALLOC_AND_FREE 2 | | #define FRIBIDI_ALLOC_AND_FREE 2 | |
| | | | |
| FriBidiMemChunk *fribidi_mem_chunk_new (char *name, | | FriBidiMemChunk *fribidi_mem_chunk_new (char *name, | |
| int atom_size, | | int atom_size, | |
| unsigned long area_size, int type)
; | | unsigned long area_size, int type)
; | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 58 | |
| #define fribidi_mem_chunk_create(type, pre_alloc, alloc_type) ( \ | | #define fribidi_mem_chunk_create(type, pre_alloc, alloc_type) ( \ | |
| fribidi_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \ | | fribidi_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \ | |
| sizeof (type), \ | | sizeof (type), \ | |
| sizeof (type) * (pre_alloc), \ | | sizeof (type) * (pre_alloc), \ | |
| (alloc_type)) \ | | (alloc_type)) \ | |
| ) | | ) | |
| #define fribidi_chunk_new(type, chunk) ( \ | | #define fribidi_chunk_new(type, chunk) ( \ | |
| (type *) fribidi_mem_chunk_alloc (chunk) \ | | (type *) fribidi_mem_chunk_alloc (chunk) \ | |
| ) | | ) | |
| | | | |
|
| int fribidi_strcasecmp (const char *s1, const char *s2); | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* FRIBIDI_MEM_H */ | | #endif /* FRIBIDI_MEM_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 38 lines changed or deleted | | 1 lines changed or added | |
|
| fribidi_types.h | | fribidi_types.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * along with this library, in a file named COPYING; if not, write to the | | * along with this library, in a file named COPYING; if not, write to the | |
| * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
| * Boston, MA 02111-1307, USA | | * Boston, MA 02111-1307, USA | |
| * | | * | |
| * For licensing issues, contact <dov@imagic.weizmann.ac.il> and | | * For licensing issues, contact <dov@imagic.weizmann.ac.il> and | |
| * <fwpg@sharif.edu>. | | * <fwpg@sharif.edu>. | |
| */ | | */ | |
| #ifndef FRIBIDI_TYPES_H | | #ifndef FRIBIDI_TYPES_H | |
| #define FRIBIDI_TYPES_H | | #define FRIBIDI_TYPES_H | |
| | | | |
|
| #include "fribidi_mem.h" | | #include "fribidi_config.h" | |
| | | #include <stdint.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
|
| | | typedef int fribidi_boolean; | |
| | | | |
| | | typedef int8_t fribidi_int8; | |
| | | typedef uint8_t fribidi_uint8; | |
| | | typedef int16_t fribidi_int16; | |
| | | typedef uint16_t fribidi_uint16; | |
| | | typedef int32_t fribidi_int32; | |
| | | typedef uint32_t fribidi_uint32; | |
| | | typedef int fribidi_int; | |
| | | typedef unsigned int fribidi_uint; | |
| | | | |
| typedef fribidi_int8 FriBidiLevel; | | typedef fribidi_int8 FriBidiLevel; | |
| typedef fribidi_uint32 FriBidiChar; | | typedef fribidi_uint32 FriBidiChar; | |
| typedef fribidi_int FriBidiStrIndex; | | typedef fribidi_int FriBidiStrIndex; | |
| typedef fribidi_int32 FriBidiMaskType; | | typedef fribidi_int32 FriBidiMaskType; | |
| typedef FriBidiMaskType FriBidiCharType; | | typedef FriBidiMaskType FriBidiCharType; | |
| | | | |
| char *fribidi_type_name (FriBidiCharType c); | | char *fribidi_type_name (FriBidiCharType c); | |
| | | | |
| /* The following type is used by fribidi_utils */ | | /* The following type is used by fribidi_utils */ | |
| typedef struct | | typedef struct | |
| { | | { | |
| FriBidiStrIndex length; | | FriBidiStrIndex length; | |
| void *attribute; | | void *attribute; | |
| } | | } | |
| FriBidiRunType; | | FriBidiRunType; | |
| | | | |
|
| | | /* The following type is used by fribdi_utils */ | |
| | | typedef struct _FriBidiList FriBidiList; | |
| | | struct _FriBidiList | |
| | | { | |
| | | void *data; | |
| | | FriBidiList *next; | |
| | | FriBidiList *prev; | |
| | | }; | |
| | | | |
| #ifndef FRIBIDI_MAX_STRING_LENGTH | | #ifndef FRIBIDI_MAX_STRING_LENGTH | |
| #define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \ | | #define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \ | |
| 0x7FFE : (sizeof (FriBidiStrIndex) == 1 ?
\ | | 0x7FFE : (sizeof (FriBidiStrIndex) == 1 ?
\ | |
| 0x7E : 0x8FFFFFFEL)) | | 0x7E : 0x8FFFFFFEL)) | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Define some bit masks, that character types are based on, each one has | | * Define some bit masks, that character types are based on, each one has | |
| * only one bit on. | | * only one bit on. | |
| */ | | */ | |
| | | | |
| skipping to change at line 195 | | skipping to change at line 216 | |
| | | | |
| /* Is private-use value? */ | | /* Is private-use value? */ | |
| #define FRIBIDI_TYPE_PRIVATE(p) ((p) < 0) | | #define FRIBIDI_TYPE_PRIVATE(p) ((p) < 0) | |
| | | | |
| /* Return the direction of the level number, FRIBIDI_TYPE_LTR for even and | | /* Return the direction of the level number, FRIBIDI_TYPE_LTR for even and | |
| FRIBIDI_TYPE_RTL for odds. */ | | FRIBIDI_TYPE_RTL for odds. */ | |
| #define FRIBIDI_LEVEL_TO_DIR(lev) (FRIBIDI_TYPE_LTR | (lev & 1)) | | #define FRIBIDI_LEVEL_TO_DIR(lev) (FRIBIDI_TYPE_LTR | (lev & 1)) | |
| | | | |
| /* Return the minimum level of the direction, 0 for FRIBIDI_TYPE_LTR and | | /* Return the minimum level of the direction, 0 for FRIBIDI_TYPE_LTR and | |
| 1 for FRIBIDI_TYPE_RTL and FRIBIDI_TYPE_AL. */ | | 1 for FRIBIDI_TYPE_RTL and FRIBIDI_TYPE_AL. */ | |
|
| #define FRIBIDI_DIR_TO_LEVEL(dir) (dir & 1) | | #define FRIBIDI_DIR_TO_LEVEL(dir) ((FriBidiLevel)(dir & 1)) | |
| | | | |
| /* Is right to left? */ | | /* Is right to left? */ | |
| #define FRIBIDI_IS_RTL(p) ((p) & FRIBIDI_MASK_RTL) | | #define FRIBIDI_IS_RTL(p) ((p) & FRIBIDI_MASK_RTL) | |
| /* Is arabic? */ | | /* Is arabic? */ | |
| #define FRIBIDI_IS_ARABIC(p) ((p) & FRIBIDI_MASK_ARABIC) | | #define FRIBIDI_IS_ARABIC(p) ((p) & FRIBIDI_MASK_ARABIC) | |
| | | | |
| /* Is strong? */ | | /* Is strong? */ | |
| #define FRIBIDI_IS_STRONG(p) ((p) & FRIBIDI_MASK_STRONG) | | #define FRIBIDI_IS_STRONG(p) ((p) & FRIBIDI_MASK_STRONG) | |
| /* Is weak? */ | | /* Is weak? */ | |
| #define FRIBIDI_IS_WEAK(p) ((p) & FRIBIDI_MASK_WEAK) | | #define FRIBIDI_IS_WEAK(p) ((p) & FRIBIDI_MASK_WEAK) | |
| | | | |
| skipping to change at line 273 | | skipping to change at line 294 | |
| | | | |
| /* | | /* | |
| * Define character types that char_type_tables use. | | * Define character types that char_type_tables use. | |
| * define them to be 0, 1, 2, ... and then in fribidi_get_type.c map them | | * define them to be 0, 1, 2, ... and then in fribidi_get_type.c map them | |
| * to FriBidiCharTypes. | | * to FriBidiCharTypes. | |
| */ | | */ | |
| typedef char FriBidiPropCharType; | | typedef char FriBidiPropCharType; | |
| | | | |
| enum FriBidiPropEnum | | enum FriBidiPropEnum | |
| { | | { | |
|
| FRIBIDI_PROP_TYPE_LTR, /* Strong left to right */ | | #define _FRIBIDI_ADD_TYPE(TYPE) FRIBIDI_PROP_TYPE_##TYPE, | |
| FRIBIDI_PROP_TYPE_RTL, /* Right to left characters */ | | #include "fribidi_types.i" | |
| FRIBIDI_PROP_TYPE_AL, /* Arabic characters */ | | #undef _FRIBIDI_ADD_TYPE | |
| FRIBIDI_PROP_TYPE_LRE, /* Left-To-Right embedding */ | | | |
| FRIBIDI_PROP_TYPE_RLE, /* Right-To-Left embedding */ | | | |
| FRIBIDI_PROP_TYPE_LRO, /* Left-To-Right override */ | | | |
| FRIBIDI_PROP_TYPE_RLO, /* Right-To-Left override */ | | | |
| FRIBIDI_PROP_TYPE_PDF, /* Pop directional override */ | | | |
| FRIBIDI_PROP_TYPE_EN, /* European digit */ | | | |
| FRIBIDI_PROP_TYPE_AN, /* Arabic digit */ | | | |
| FRIBIDI_PROP_TYPE_ES, /* European number separator */ | | | |
| FRIBIDI_PROP_TYPE_ET, /* European number terminator */ | | | |
| FRIBIDI_PROP_TYPE_CS, /* Common Separator */ | | | |
| FRIBIDI_PROP_TYPE_NSM, /* Non spacing mark */ | | | |
| FRIBIDI_PROP_TYPE_BN, /* Boundary neutral */ | | | |
| FRIBIDI_PROP_TYPE_BS, /* Block separator */ | | | |
| FRIBIDI_PROP_TYPE_SS, /* Segment separator */ | | | |
| FRIBIDI_PROP_TYPE_WS, /* Whitespace */ | | | |
| FRIBIDI_PROP_TYPE_ON, /* Other Neutral */ | | | |
| FRIBIDI_PROP_TYPE_WL, /* Weak left to right */ | | | |
| FRIBIDI_PROP_TYPE_WR, /* Weak right to left */ | | | |
| FRIBIDI_TYPES_COUNT /* Number of different character typ
es */ | | FRIBIDI_TYPES_COUNT /* Number of different character typ
es */ | |
| }; | | }; | |
| | | | |
| /* Map fribidi_prop_types to fribidi_types */ | | /* Map fribidi_prop_types to fribidi_types */ | |
| extern FriBidiCharType *fribidi_prop_to_type; | | extern FriBidiCharType *fribidi_prop_to_type; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 23 lines changed or deleted | | 26 lines changed or added | |
|
| fribidi_unicode.h | | fribidi_unicode.h | |
| /* FriBidi - Library of BiDi algorithm | | /* FriBidi - Library of BiDi algorithm | |
|
| * Copyright (C) 2001,2002 Behdad Esfahbod. | | * Copyright (C) 2001,2002,2005 Behdad Esfahbod. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| * along with this library, in a file named COPYING; if not, write to the | | * along with this library, in a file named COPYING; if not, write to the | |
| * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
| * Boston, MA 02111-1307, USA | | * Boston, MA 02111-1307, USA | |
| * | | * | |
| * For licensing issues, contact <fwpg@sharif.edu>. | | * For licensing issues, contact <fwpg@sharif.edu>. | |
| */ | | */ | |
| | | | |
| #ifndef FRIBIDI_UNICODE_H | | #ifndef FRIBIDI_UNICODE_H | |
| #define FRIBIDI_UNICODE_H | | #define FRIBIDI_UNICODE_H | |
| | | | |
|
| | | #include "fribidi_config.h" | |
| #include "fribidi_types.h" | | #include "fribidi_types.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| /* Unicode version */ | | /* Unicode version */ | |
|
| #define FRIBIDI_UNICODE_CHARS 0x110000 | | #define FRIBIDI_UNICODE_CHARS (sizeof(FriBidiChar) >= 4 ? 0x110000 : 0x100 | |
| #define FRIBIDI_UNICODE_VERSION "3.2.0" | | 00) | |
| | | #define FRIBIDI_UNICODE_VERSION "4.1.0" | |
| | | | |
| /* UAX#9 Unicode BiDirectional Algorithm */ | | /* UAX#9 Unicode BiDirectional Algorithm */ | |
| #define UNI_MAX_BIDI_LEVEL 61 | | #define UNI_MAX_BIDI_LEVEL 61 | |
| | | | |
| /* BiDirectional marks */ | | /* BiDirectional marks */ | |
| #define UNI_LRM 0x200E | | #define UNI_LRM 0x200E | |
| #define UNI_RLM 0x200F | | #define UNI_RLM 0x200F | |
| #define UNI_LRE 0x202A | | #define UNI_LRE 0x202A | |
| #define UNI_RLE 0x202B | | #define UNI_RLE 0x202B | |
| #define UNI_PDF 0x202C | | #define UNI_PDF 0x202C | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 64 | |
| #define UNI_ZWNJ 0x200C | | #define UNI_ZWNJ 0x200C | |
| #define UNI_ZWJ 0x200D | | #define UNI_ZWJ 0x200D | |
| | | | |
| /* Hebrew and Arabic */ | | /* Hebrew and Arabic */ | |
| #define UNI_HEBREW_ALEF 0x05D0 | | #define UNI_HEBREW_ALEF 0x05D0 | |
| #define UNI_ARABIC_ALEF 0x0627 | | #define UNI_ARABIC_ALEF 0x0627 | |
| #define UNI_ARABIC_ZERO 0x0660 | | #define UNI_ARABIC_ZERO 0x0660 | |
| #define UNI_FARSI_ZERO 0x06F0 | | #define UNI_FARSI_ZERO 0x06F0 | |
| | | | |
| /* wcwidth functions */ | | /* wcwidth functions */ | |
|
| int fribidi_wcwidth (FriBidiChar ch); | | FRIBIDI_API int fribidi_wcwidth (FriBidiChar ch); | |
| int fribidi_wcswidth (const FriBidiChar *str, FriBidiStrIndex len); | | FRIBIDI_API int fribidi_wcswidth (const FriBidiChar *str, | |
| int fribidi_wcswidth_cjk (const FriBidiChar *str, FriBidiStrIndex len); | | FriBidiStrIndex len); | |
| | | FRIBIDI_API int fribidi_wcswidth_cjk (const FriBidiChar *str, | |
| | | FriBidiStrIndex len); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* FRIBIDI_UNICODE_H */ | | #endif /* FRIBIDI_UNICODE_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 10 lines changed or added | |
|