|
||||
File indexing completed on 2025-01-18 09:57:27
0001 /* FriBidi 0002 * fribidi-bidi.h - bidirectional algorithm 0003 * 0004 * Authors: 0005 * Behdad Esfahbod, 2001, 2002, 2004 0006 * Dov Grobgeld, 1999, 2000 0007 * 0008 * Copyright (C) 2004 Sharif FarsiWeb, Inc 0009 * Copyright (C) 2001,2002 Behdad Esfahbod 0010 * Copyright (C) 1999,2000 Dov Grobgeld 0011 * 0012 * This library is free software; you can redistribute it and/or 0013 * modify it under the terms of the GNU Lesser General Public 0014 * License as published by the Free Software Foundation; either 0015 * version 2.1 of the License, or (at your option) any later version. 0016 * 0017 * This library is distributed in the hope that it will be useful, 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0020 * Lesser General Public License for more details. 0021 * 0022 * You should have received a copy of the GNU Lesser General Public License 0023 * along with this library, in a file named COPYING; if not, write to the 0024 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0025 * Boston, MA 02110-1301, USA 0026 * 0027 * For licensing issues, contact <fribidi.license@gmail.com>. 0028 */ 0029 #ifndef _FRIBIDI_BIDI_H 0030 #define _FRIBIDI_BIDI_H 0031 0032 #include "fribidi-common.h" 0033 0034 #include "fribidi-types.h" 0035 #include "fribidi-flags.h" 0036 #include "fribidi-bidi-types.h" 0037 0038 #include "fribidi-begindecls.h" 0039 0040 /* fribidi_get_par_direction - get base paragraph direction 0041 * 0042 * This function finds the base direction of a single paragraph, 0043 * as defined by rule P2 of the Unicode Bidirectional Algorithm available at 0044 * http://www.unicode.org/reports/tr9/#P2. 0045 * 0046 * You typically do not need this function as 0047 * fribidi_get_par_embedding_levels() knows how to compute base direction 0048 * itself, but you may need this to implement a more sophisticated paragraph 0049 * direction handling. Note that you can pass more than a paragraph to this 0050 * function and the direction of the first non-neutral paragraph is returned, 0051 * which is a very good heuristic to set direction of the neutral paragraphs 0052 * at the beginning of text. For other neutral paragraphs, you better use the 0053 * direction of the previous paragraph. 0054 * 0055 * Returns: Base pargraph direction. No weak paragraph direction is returned, 0056 * only LTR, RTL, or ON. 0057 */ 0058 FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction ( 0059 const FriBidiCharType *bidi_types, /* input list of bidi types as returned by 0060 fribidi_get_bidi_types() */ 0061 const FriBidiStrIndex len /* input string length */ 0062 ); 0063 0064 /* fribidi_get_par_embedding_levels_ex - get bidi embedding levels of a paragraph 0065 * 0066 * This function finds the bidi embedding levels of a single paragraph, 0067 * as defined by the Unicode Bidirectional Algorithm available at 0068 * http://www.unicode.org/reports/tr9/. This function implements rules P2 to 0069 * I1 inclusive, and parts 1 to 3 of L1, except for rule X9 which is 0070 * implemented in fribidi_remove_bidi_marks(). Part 4 of L1 is implemented 0071 * in fribidi_reorder_line(). 0072 * 0073 * There are a few macros defined in fribidi-bidi-types.h to work with this 0074 * embedding levels. 0075 * 0076 * Returns: Maximum level found plus one, or zero if any error occurred 0077 * (memory allocation failure most probably). 0078 */ 0079 FRIBIDI_ENTRY FriBidiLevel 0080 fribidi_get_par_embedding_levels_ex ( 0081 const FriBidiCharType *bidi_types, /* input list of bidi types as returned by 0082 fribidi_get_bidi_types() */ 0083 const FriBidiBracketType *bracket_types, /* input list of bracket types as returned by 0084 fribidi_get_bracket_types() */ 0085 const FriBidiStrIndex len, /* input string length of the paragraph */ 0086 FriBidiParType *pbase_dir, /* requested and resolved paragraph 0087 * base direction */ 0088 FriBidiLevel *embedding_levels /* output list of embedding levels */ 0089 ) FRIBIDI_GNUC_WARN_UNUSED; 0090 0091 /* fribidi_reorder_line - reorder a line of logical string to visual 0092 * 0093 * This function reorders the characters in a line of text from logical to 0094 * final visual order. This function implements part 4 of rule L1, and rules 0095 * L2 and L3 of the Unicode Bidirectional Algorithm available at 0096 * http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels. 0097 * 0098 * As a side effect it also sets position maps if not NULL. 0099 * 0100 * You should provide the resolved paragraph direction and embedding levels as 0101 * set by fribidi_get_par_embedding_levels(). Also note that the embedding 0102 * levels may change a bit. To be exact, the embedding level of any sequence 0103 * of white space at the end of line is reset to the paragraph embedding level 0104 * (That is part 4 of rule L1). 0105 * 0106 * Note that the bidi types and embedding levels are not reordered. You can 0107 * reorder these (or any other) arrays using the map later. The user is 0108 * responsible to initialize map to something sensible, like an identity 0109 * mapping, or pass NULL if no map is needed. 0110 * 0111 * There is an optional part to this function, which is whether non-spacing 0112 * marks for right-to-left parts of the text should be reordered to come after 0113 * their base characters in the visual string or not. Most rendering engines 0114 * expect this behavior, but console-based systems for example do not like it. 0115 * This is controlled by the FRIBIDI_FLAG_REORDER_NSM flag. The flag is on 0116 * in FRIBIDI_FLAGS_DEFAULT. 0117 * 0118 * Returns: Maximum level found in this line plus one, or zero if any error 0119 * occurred (memory allocation failure most probably). 0120 */ 0121 FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line ( 0122 FriBidiFlags flags, /* reorder flags */ 0123 const FriBidiCharType *bidi_types, /* input list of bidi types as returned by 0124 fribidi_get_bidi_types() */ 0125 const FriBidiStrIndex len, /* input length of the line */ 0126 const FriBidiStrIndex off, /* input offset of the beginning of the line 0127 in the paragraph */ 0128 const FriBidiParType base_dir, /* resolved paragraph base direction */ 0129 FriBidiLevel *embedding_levels, /* input list of embedding levels, 0130 as returned by 0131 fribidi_get_par_embedding_levels */ 0132 FriBidiChar *visual_str, /* visual string to reorder */ 0133 FriBidiStrIndex *map /* a map of string indices which is reordered 0134 * to reflect where each glyph ends up. */ 0135 ) FRIBIDI_GNUC_WARN_UNUSED; 0136 0137 #include "fribidi-enddecls.h" 0138 0139 #endif /* !_FRIBIDI_BIDI_H */ 0140 /* Editor directions: 0141 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent 0142 */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |