summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-15 05:52:24 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-15 05:52:24 +0000
commit1abc8682d3a0ff9850ee5dcf3e42cc586d08ee2e (patch)
tree1413d6b818451a643c9524974ecede92706b48cf /pango
parentb46553c08c77cadc6ee6fc593386e5249217371d (diff)
downloadpango-1abc8682d3a0ff9850ee5dcf3e42cc586d08ee2e.tar.gz
Add enum PangoGravity.
2006-08-15 Behdad Esfahbod <behdad@gnome.org> * pango/pango-types.h: Add enum PangoGravity. * pango/pango-context.h: * pango/pango-context.c (pango_context_set_base_gravity), (pango_context_get_base_gravity): New functions. * pango/pango.def: * docs/pango-sections.txt: Hook new API.
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-context.c38
-rw-r--r--pango/pango-context.h3
-rw-r--r--pango/pango-types.h26
-rw-r--r--pango/pango.def2
4 files changed, 64 insertions, 5 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 2e0c2bb4..827b877f 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -36,6 +36,8 @@ struct _PangoContext
PangoLanguage *language;
PangoDirection base_dir;
+ PangoGravity base_gravity;
+
PangoFontDescription *font_desc;
PangoMatrix *matrix;
@@ -57,6 +59,7 @@ static void
pango_context_init (PangoContext *context)
{
context->base_dir = PANGO_DIRECTION_WEAK_LTR;
+ context->base_gravity = PANGO_GRAVITY_NORTH;
context->language = NULL;
context->font_map = NULL;
@@ -402,6 +405,41 @@ pango_context_get_base_dir (PangoContext *context)
return context->base_dir;
}
+/**
+ * pango_context_set_base_gravity:
+ * @context: a #PangoContext
+ * @gravity: the new base gravity
+ *
+ * Sets the base gravity for the context.
+ *
+ * The base gravity is used in laying vertical text out.
+ **/
+void
+pango_context_set_base_gravity (PangoContext *context,
+ PangoGravity gravity)
+{
+ g_return_if_fail (context != NULL);
+
+ context->base_gravity = gravity;
+}
+
+/**
+ * pango_context_get_base_gravity:
+ * @context: a #PangoContext
+ *
+ * Retrieves the base gravity for the context. See
+ * pango_context_set_base_gravity().
+ *
+ * Return value: the base gravity for the context.
+ **/
+PangoGravity
+pango_context_get_base_gravity (PangoContext *context)
+{
+ g_return_val_if_fail (context != NULL, PANGO_GRAVITY_NORTH);
+
+ return context->base_gravity;
+}
+
/**********************************************************************/
static gboolean
diff --git a/pango/pango-context.h b/pango/pango-context.h
index 385c2d93..97af918c 100644
--- a/pango/pango-context.h
+++ b/pango/pango-context.h
@@ -78,6 +78,9 @@ void pango_context_set_language (PangoContext
void pango_context_set_base_dir (PangoContext *context,
PangoDirection direction);
PangoDirection pango_context_get_base_dir (PangoContext *context);
+void pango_context_set_base_gravity (PangoContext *context,
+ PangoGravity gravity);
+PangoGravity pango_context_get_base_gravity (PangoContext *context);
void pango_context_set_matrix (PangoContext *context,
const PangoMatrix *matrix);
diff --git a/pango/pango-types.h b/pango/pango-types.h
index 980658a3..4ab528cd 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -168,11 +168,8 @@ double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix);
* 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.
+ * text and are no longer used; See #PangoGravity for how
+ * vertical text is handled in Pango.
**/
typedef enum {
PANGO_DIRECTION_LTR,
@@ -184,6 +181,25 @@ typedef enum {
PANGO_DIRECTION_NEUTRAL
} PangoDirection;
+/**
+ * PangoGravity:
+ * @PANGO_GRAVITY_NORTH: Glyphs stand upright (default)
+ * @PANGO_GRAVITY_WEST: Glyphs are rotated 90 degrees clockwise
+ * @PANGO_GRAVITY_SOUTH: Glyphs are upside-down
+ * @PANGO_GRAVITY_EAST: Glyphs are rotated 90 degrees counter-clockwise
+ *
+ * The #PangoGravity type represents the direction that the glyphs are
+ * rotated. This is useful when rendering vertical text layouts. In
+ * those situations, the layout is rotated using a non-identity PangoMatrix,
+ * and then glyph rotation is controlled using #PangoGravity.
+ **/
+typedef enum {
+ PANGO_GRAVITY_NORTH,
+ PANGO_GRAVITY_WEST,
+ PANGO_GRAVITY_SOUTH,
+ PANGO_GRAVITY_EAST
+} PangoGravity;
+
#define PANGO_TYPE_LANGUAGE (pango_language_get_type ())
GType pango_language_get_type (void);
diff --git a/pango/pango.def b/pango/pango.def
index bb1a7e60..d39b1805 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -53,6 +53,7 @@ EXPORTS
pango_context_get_base_dir
pango_context_get_font_description
pango_context_get_font_map
+ pango_context_get_gravity
pango_context_get_language
pango_context_get_matrix
pango_context_get_metrics
@@ -64,6 +65,7 @@ EXPORTS
pango_context_set_base_dir
pango_context_set_font_description
pango_context_set_font_map
+ pango_context_set_gravity
pango_context_set_language
pango_context_set_matrix
pango_coverage_copy