2 /* Copyright (C) 2002 Mikhael Goikhman */
4 * FBidi.h - interface to Bidi (bidirectionality for some asian languages).
9 * const char *logical_str, const char *charset, int str_len, Bool *is_rtl,
13 * logical string - the original string
14 * string charset - examples: "iso8859-15", "iso8859-8", "iso8859-6", "utf-8"
17 * visual string is returned (should be free'd), or NULL if not applicable
18 * the last argument is set to True if the string has the base RTL direction
20 * The is_rtl aggument may be used for 2 purposes. The first is to change the
21 * string alignment if there is a free space (but it probably worth not to
22 * override the user specified string aligment). The second is to determine
23 * where to put ellipses if the string is longer than the available space.
25 * There are several possible ways to solve the ellipses problem.
26 * This is not automated, the caller should choose one or another way.
28 * 1) For a logical string evaluate a visual string (and a base direction)
29 * only once. If needed, cut the visual string and add ellipses at the
30 * correct string side.
32 * 2) Cut logical string to the size that will be drawn, add allipses to the
33 * end and call FBidiConvert on the resulting string.
35 * 3) Cut logical string to the size that will be drawn, call FBidiConvert
36 * and add ellipses at the correct string side.
38 * Probably 2) is the best, but there is one nuance, the ellipses may be at
39 * the middle of the string. With 1) and 3) the ellipses are always on the
40 * edge of the string. The 1) is good when speed is more important than memory
41 * and the string is usually either pure LTR or RTL.
45 * input: she said "SHALOM" and then "BOKER TOV".
46 * output: she said "MOLAHS" and then "VOT REKOB".
55 * input: SHALOM, world!
56 * output: !world ,MOLAHS
70 #include "CombineChars.h"
74 * Checks whether the string in the given charset should be BidiConvert'd.
76 Bool
FBidiIsApplicable(const char *charset
);
79 * Converts the given logical string to visual string for the given charset.
82 const char *logical_str
, const char *charset
, int str_len
,
83 Bool
*is_rtl
, int *out_len
, superimpose_char_t
*comb_chars
,
86 #else /* !HAVE_BIDI */
88 #define FBidiIsApplicable(c) False
90 #define FBidiConvert(s, c, l, r, o, cc, lv) NULL
92 #endif /* HAVE_BIDI */