summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--ChangeLog.pre-1-1023
-rw-r--r--ChangeLog.pre-1-423
-rw-r--r--ChangeLog.pre-1-623
-rw-r--r--ChangeLog.pre-1-823
-rw-r--r--docs/pango-sections.txt6
-rw-r--r--docs/tmpl/fonts.sgml19
-rw-r--r--docs/tmpl/main.sgml46
-rw-r--r--pango/mini-fribidi/fribidi.c39
-rw-r--r--pango/pango-context.c14
-rw-r--r--pango/pango-types.h46
-rw-r--r--pango/pango-utils.c36
-rw-r--r--pango/pango-utils.h10
13 files changed, 309 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 538b5478..7f558f6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+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()
+
2003-02-26 Noah Levitt <nlevitt@columbia.edu>
* pango/pangofc-fontmap.c: Use g_array_sort correctly.
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 538b5478..7f558f6d 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,26 @@
+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()
+
2003-02-26 Noah Levitt <nlevitt@columbia.edu>
* pango/pangofc-fontmap.c: Use g_array_sort correctly.
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 538b5478..7f558f6d 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,26 @@
+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()
+
2003-02-26 Noah Levitt <nlevitt@columbia.edu>
* pango/pangofc-fontmap.c: Use g_array_sort correctly.
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 538b5478..7f558f6d 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,26 @@
+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()
+
2003-02-26 Noah Levitt <nlevitt@columbia.edu>
* pango/pangofc-fontmap.c: Use g_array_sort correctly.
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 538b5478..7f558f6d 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,26 @@
+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()
+
2003-02-26 Noah Levitt <nlevitt@columbia.edu>
* pango/pangofc-fontmap.c: Use g_array_sort correctly.
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 5fafd4f4..b5bb99d0 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -27,6 +27,10 @@ pango_context_load_font
pango_context_load_fontset
pango_context_get_metrics
pango_context_list_families
+<SUBSECTION>
+pango_get_mirror_char
+pango_unichar_direction
+pango_find_base_dir
<SUBSECTION Standard>
PANGO_TYPE_CONTEXT
PangoContextClass
@@ -172,6 +176,7 @@ PANGO_TYPE_FONT_FAMILY
PANGO_FONT_FAMILY
PANGO_IS_FONT_FAMILY
pango_font_family_get_name
+pango_font_family_is_monospace
pango_font_family_list_faces
<SUBSECTION>
PangoFontFace
@@ -179,6 +184,7 @@ PANGO_TYPE_FONT_FACE
PANGO_FONT_FACE
PANGO_IS_FONT_FACE
pango_font_face_get_face_name
+pango_font_face_list_sizes
pango_font_face_describe
<SUBSECTION>
PangoFontMap
diff --git a/docs/tmpl/fonts.sgml b/docs/tmpl/fonts.sgml
index 3d214e4d..5b2ff5ba 100644
--- a/docs/tmpl/fonts.sgml
+++ b/docs/tmpl/fonts.sgml
@@ -588,6 +588,15 @@ Returns %TRUE if @object is a #PangoFontFamily.
@Returns:
+<!-- ##### FUNCTION pango_font_family_is_monospace ##### -->
+<para>
+
+</para>
+
+@family:
+@Returns:
+
+
<!-- ##### FUNCTION pango_font_family_list_faces ##### -->
<para>
@@ -637,6 +646,16 @@ Returns %TRUE if @object is a #PangoFontFace.
@Returns:
+<!-- ##### FUNCTION pango_font_face_list_sizes ##### -->
+<para>
+
+</para>
+
+@face:
+@sizes:
+@n_sizes:
+
+
<!-- ##### FUNCTION pango_font_face_describe ##### -->
<para>
diff --git a/docs/tmpl/main.sgml b/docs/tmpl/main.sgml
index bb894008..5901eca7 100644
--- a/docs/tmpl/main.sgml
+++ b/docs/tmpl/main.sgml
@@ -52,18 +52,15 @@ fields:
<!-- ##### ENUM PangoDirection ##### -->
<para>
-The #PangoDirection type represents the direction of writing
-for text.
</para>
-@PANGO_DIRECTION_LTR: The text is written left-to-right
-@PANGO_DIRECTION_RTL: The text is written right-to-left
-@PANGO_DIRECTION_TTB_LTR: The text is written vertically
- top-to-bottom, with the rows ordered from
- left to right.
-@PANGO_DIRECTION_TTB_RTL: The text is written vertically
- top-to-bottom, with the rows ordered from
- right to left.
+@PANGO_DIRECTION_LTR:
+@PANGO_DIRECTION_RTL:
+@PANGO_DIRECTION_TTB_LTR:
+@PANGO_DIRECTION_TTB_RTL:
+@PANGO_DIRECTION_WEAK_LTR:
+@PANGO_DIRECTION_WEAK_RTL:
+@PANGO_DIRECTION_NEUTRAL:
<!-- ##### MACRO PANGO_TYPE_DIRECTION ##### -->
<para>
@@ -244,6 +241,35 @@ The GObject type for #PangoDirection.
@n_families:
+<!-- ##### FUNCTION pango_get_mirror_char ##### -->
+<para>
+
+</para>
+
+@ch:
+@mirrored_ch:
+@Returns:
+
+
+<!-- ##### FUNCTION pango_unichar_direction ##### -->
+<para>
+
+</para>
+
+@ch:
+@Returns:
+
+
+<!-- ##### FUNCTION pango_find_base_dir ##### -->
+<para>
+
+</para>
+
+@text:
+@length:
+@Returns:
+
+
<!-- ##### FUNCTION pango_break ##### -->
<para>
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;
+}
diff --git a/pango/pango-context.c b/pango/pango-context.c
index ea6d66e4..520ddff1 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -83,7 +83,7 @@ pango_context_get_type (void)
static void
pango_context_init (PangoContext *context)
{
- context->base_dir = PANGO_DIRECTION_LTR;
+ context->base_dir = PANGO_DIRECTION_WEAK_LTR;
context->language = NULL;
context->font_map = NULL;
@@ -325,6 +325,13 @@ pango_context_get_language (PangoContext *context)
* @direction: the new base direction
*
* Sets the base direction for the context.
+ *
+ * The base direction is used in applying the Unicode bidirectional
+ * algorithm; if the @direction is %PANGO_DIRECTION_LTR or
+ * %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
+ * direction in the Unicode bidirectional algorithm. A value of
+ * %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
+ * for paragraphs that do not contain any strong characters themselves.
**/
void
pango_context_set_base_dir (PangoContext *context,
@@ -337,9 +344,10 @@ pango_context_set_base_dir (PangoContext *context,
/**
* pango_context_get_base_dir:
- * @context:
+ * @context: a #PangoContext
*
- * Retrieves the base direction for the context.
+ * Retrieves the base direction for the context. See
+ * pango_context_set_base_dir().
*
* Return value: the base direction for the context.
**/
diff --git a/pango/pango-types.h b/pango/pango-types.h
index 993402aa..6f515ead 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -65,15 +65,45 @@ struct _PangoRectangle
#define PANGO_LBEARING(rect) ((rect).x)
#define PANGO_RBEARING(rect) ((rect).x + (rect).width)
-/* Information about a segment of text with a consistent
- * shaping/language engine and bidirectional level
- */
-
+/**
+ * PangoDirection:
+ * @PANGO_DIRECTION_LTR: A strong left-to-right direction
+ * @PANGO_DIRECTION_RTL: A strong right-to-left direction
+ * @PANGO_DIRECTION_TTB_LTR: Deprecated value; treated the
+ * same as %PANGO_DIRECTION_RTL.
+ * @PANGO_DIRECTION_TTB_RTL: Deprecated value; treated the
+ * same as PANGO_DIRECTION_LTR
+ * @PANGO_DIRECTION_WEAK_LTR: A weak left-to-right direction
+ * @PANGO_DIRECTION_WEAK_RTL: A weak right-to-left direction
+ * @PANGO_DIRECTION_NEUTRAL: No direction specified
+ *
+ * The #PangoDirection type represents a direction in the
+ * Unicode bidirectional algorithm; not every value in this
+ * enumeration makes sense for every usage of #PangoDirection;
+ * for example, the return value of pango_unichar_direction()
+ * and pango_find_base_direction() cannot be %PANGO_DIRECTION_WEAK_LTR
+ * or %PANGO_DIRECTION_WEAK_RTL, since every character is either
+ * neutral or has a strong direction; on the other hand
+ * %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
+ * to pango_log2vis_get_embedding_levels().
+ *
+ * The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
+ * values come from an earlier interpretation of this
+ * enumeration as the writing direction of a block of
+ * text and are no longer used; See the Text module of the
+ * CSS3 spec for how vertical text is planned to be handled
+ * in a future version of Pango. The explanation of why
+ * %PANGO_DIRECTION_TTB_LTR is treated as %PANGO_DIRECTION_RTL
+ * can be found there as well.
+ **/
typedef enum {
PANGO_DIRECTION_LTR,
PANGO_DIRECTION_RTL,
PANGO_DIRECTION_TTB_LTR,
- PANGO_DIRECTION_TTB_RTL
+ PANGO_DIRECTION_TTB_RTL,
+ PANGO_DIRECTION_WEAK_LTR,
+ PANGO_DIRECTION_WEAK_RTL,
+ PANGO_DIRECTION_NEUTRAL
} PangoDirection;
#define PANGO_TYPE_LANGUAGE (pango_language_get_type ())
@@ -85,6 +115,12 @@ PangoLanguage *pango_language_from_string (const char *language);
gboolean pango_language_matches (PangoLanguage *language,
const char *range_list);
+gboolean pango_get_mirror_char (gunichar ch,
+ gunichar *mirrored_ch);
+PangoDirection pango_unichar_direction (gunichar ch);
+PangoDirection pango_find_base_dir (const gchar *text,
+ gint length);
+
G_END_DECLS
#endif /* __PANGO_TYPES_H__ */
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 05db2610..68267772 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -1493,3 +1493,39 @@ pango_lookup_aliases (const char *fontname,
*n_families = 0;
}
}
+
+/**
+ * pango_find_base_dir:
+ * @text: the text to process
+ * @length: length of @text in bytes (may be -1 if @text is nul-terminated)
+ *
+ * Searches a string the first character that has a strong
+ * direction, according to the Unicode bidirectional algorithm.
+ *
+ * Return value: The direction corresponding to the first strong character.
+ * If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned.
+ */
+PangoDirection
+pango_find_base_dir (const gchar *text,
+ gint length)
+{
+ PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
+ const gchar *p;
+
+ g_return_val_if_fail (text != NULL, PANGO_DIRECTION_NEUTRAL);
+
+ p = text;
+ while ((length < 0 || p < text + length) && *p)
+ {
+ gunichar wc = g_utf8_get_char (p);
+
+ dir = pango_unichar_direction (wc);
+
+ if (dir != PANGO_DIRECTION_NEUTRAL)
+ break;
+
+ p = g_utf8_next_char (p);
+ }
+
+ return dir;
+}
diff --git a/pango/pango-utils.h b/pango/pango-utils.h
index 64b96eea..20b828e4 100644
--- a/pango/pango-utils.h
+++ b/pango/pango-utils.h
@@ -19,10 +19,15 @@
* Boston, MA 02111-1307, USA.
*/
+#ifndef __PANGO_UTILS_H__
+#define __PANGO_UTILS_H__
+
#include <stdio.h>
#include <glib.h>
#include <pango/pango-font.h>
+G_BEGIN_DECLS
+
char ** pango_split_file_list (const char *str);
char *pango_trim_string (const char *str);
@@ -88,8 +93,9 @@ gboolean pango_log2vis_get_embedding_levels (gunichar *str,
int len,
PangoDirection *pbase_dir,
guint8 *embedding_level_list);
-gboolean pango_get_mirror_char (gunichar ch,
- gunichar *mirrored_ch);
G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language);
+G_END_DECLS
+
+#endif /* __PANGO_UTILS_H__ */