summaryrefslogtreecommitdiff
path: root/pango/mini-fribidi
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-02-27 14:48:54 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-02-27 14:48:54 +0000
commit58a45b6a10cf9ca55b3216e233f6b516c75755de (patch)
treee6820c29dec5b9b8051a378a47bf4629bbfcdd47 /pango/mini-fribidi
parentf27610770305444fcab90ce651f48265e41dfee2 (diff)
downloadpango-58a45b6a10cf9ca55b3216e233f6b516c75755de.tar.gz
Add some new enum and values and utilities for supporting automatically
Fri Feb 27 09:30:10 2004 Owen Taylor <otaylor@redhat.com> Add some new enum and values and utilities for supporting automatically determined base direction. (#70451, based on changes by Dov Grobgeld) * pango/pango-types.h docs/tmpl/main.sgml: Add PANGO_DIRECTION_WEAK_RTL/LTR, extend the docs for PangoDirection. * pango/pango-types.h pango/pango-utils.h: Move pango_get_mirror_char() to pango-types.h. * pango/mini-fribidi/fribidi.c (pango_log2vis_get_embedding_levels): Handle new values of PangoDirection, handle PANGO_DIRECTION_TTB_LTR/RTL as aliases for PANGO_DIRECTION_RTL/LTR. * pango/mini-fribidi/fribidi.c pango/pango-types.h: Add pango_unichar_direction(). * pango/pango-utils.c pango/pango-types.h: Add pango_find_base_dir()
Diffstat (limited to 'pango/mini-fribidi')
-rw-r--r--pango/mini-fribidi/fribidi.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/pango/mini-fribidi/fribidi.c b/pango/mini-fribidi/fribidi.c
index e298f404..2a850c46 100644
--- a/pango/mini-fribidi/fribidi.c
+++ b/pango/mini-fribidi/fribidi.c
@@ -1006,8 +1006,24 @@ pango_log2vis_get_embedding_levels (/* input */
DBG ("Entering fribidi_log2vis_get_embedding_levels()\n");
- fribidi_base_dir = (*pbase_dir == PANGO_DIRECTION_LTR) ? FRIBIDI_TYPE_LTR : FRIBIDI_TYPE_RTL;
-
+ switch (*pbase_dir)
+ {
+ case PANGO_DIRECTION_LTR:
+ case PANGO_DIRECTION_TTB_RTL:
+ fribidi_base_dir = FRIBIDI_TYPE_L;
+ break;
+ case PANGO_DIRECTION_RTL:
+ case PANGO_DIRECTION_TTB_LTR:
+ fribidi_base_dir = FRIBIDI_TYPE_R;
+ break;
+ case PANGO_DIRECTION_WEAK_LTR:
+ fribidi_base_dir = FRIBIDI_TYPE_WL;
+ break;
+ case PANGO_DIRECTION_WEAK_RTL:
+ fribidi_base_dir = FRIBIDI_TYPE_WR;
+ break;
+ }
+
if (len == 0)
{
DBG ("Leaving fribidi_log2vis_get_embedding_levels()\n");
@@ -1033,3 +1049,22 @@ pango_log2vis_get_embedding_levels (/* input */
return TRUE;
}
+/**
+ * pango_unichar_direction:
+ * @ch: character to examine
+ *
+ * Returns the direction of a character, as used in the
+ * Unicode bidirectional algorithm.
+ */
+PangoDirection
+pango_unichar_direction (gunichar ch)
+{
+ FriBidiCharType fribidi_ch_type = _pango_fribidi_get_type (ch);
+
+ if (!FRIBIDI_IS_LETTER (fribidi_ch_type))
+ return PANGO_DIRECTION_NEUTRAL;
+ else if (FRIBIDI_IS_RTL (fribidi_ch_type))
+ return PANGO_DIRECTION_RTL;
+ else
+ return PANGO_DIRECTION_LTR;
+}