diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2008-04-21 23:56:37 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2008-04-21 23:56:37 +0000 |
commit | 03cab3cab0ca0a48dc712ffce290a259bc2b49c5 (patch) | |
tree | b6b669242caa218684b12ff69deec66b0de57f31 /pango/pango-utils.c | |
parent | 30401e22f1a7417ad71045966a51c30e5f126cbb (diff) | |
download | pango-03cab3cab0ca0a48dc712ffce290a259bc2b49c5.tar.gz |
Bug 515432 – Add function to get bidirectional character type of a
2008-04-21 Behdad Esfahbod <behdad@gnome.org>
Bug 515432 – Add function to get bidirectional character type of a
unicode character
Patch from Jürg Billeter
* docs/pango-sections.txt:
* docs/tmpl/layout.sgml:
* docs/tmpl/main.sgml:
* docs/tmpl/pangocairo.sgml:
* pango/Makefile.am:
* pango/pango-bidi-type.c (pango_bidi_type_for_unichar):
* pango/pango-bidi-type.h:
* pango/pango-types.h:
* pango/pango-utils.c (pango_log2vis_get_embedding_levels),
(pango_unichar_direction):
* pango/pango.def:
* pango/pango.h:
New public API:
enum PangoBidiType;
pango_bidi_type_get_type()
pango_bidi_type_for_unichar()
svn path=/trunk/; revision=2607
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r-- | pango/pango-utils.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index d2e49924..9ade0691 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -1128,10 +1128,8 @@ pango_log2vis_get_embedding_levels (const gchar *text, case PANGO_DIRECTION_WEAK_RTL: fribidi_base_dir = FRIBIDI_TYPE_WR; break; - /* case PANGO_DIRECTION_WEAK_LTR: case PANGO_DIRECTION_NEUTRAL: - */ default: fribidi_base_dir = FRIBIDI_TYPE_WL; break; @@ -1165,19 +1163,23 @@ pango_log2vis_get_embedding_levels (const gchar *text, * pango_unichar_direction: * @ch: a Unicode character * - * Determines the direction of a character; either + * Determines the inherent direction of a character; either * %PANGO_DIRECTION_LTR, %PANGO_DIRECTION_RTL, or * %PANGO_DIRECTION_NEUTRAL. * - * Return value: the direction of the character, as used in the - * Unicode bidirectional algorithm. + * This function is useful to categorize characters into left-to-right + * letters, right-to-left letters, and everything else. If full + * Unicode bidirectional type of a character is needed, + * pango_bidi_type_for_gunichar() can be used instead. + * + * Return value: the direction of the character. */ PangoDirection pango_unichar_direction (gunichar ch) { FriBidiCharType fribidi_ch_type = fribidi_get_type (ch); - if (!FRIBIDI_IS_LETTER (fribidi_ch_type)) + if (!FRIBIDI_IS_STRONG (fribidi_ch_type)) return PANGO_DIRECTION_NEUTRAL; else if (FRIBIDI_IS_RTL (fribidi_ch_type)) return PANGO_DIRECTION_RTL; |