summaryrefslogtreecommitdiff
path: root/pango/pango-context.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-15 06:38:12 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-15 06:38:12 +0000
commitfa4060b583954b6ac17b674b8b6da590bc86163f (patch)
treeb292690a75da191391052b4bbbce5e2913fc4783 /pango/pango-context.c
parent1abc8682d3a0ff9850ee5dcf3e42cc586d08ee2e (diff)
downloadpango-fa4060b583954b6ac17b674b8b6da590bc86163f.tar.gz
Add a gravity member to PangoItem, and
2006-08-15 Behdad Esfahbod <behdad@gnome.org> * pango/pango-item.h: Add a gravity member to PangoItem, and * pango/pango-context.c (itemize_state_init), (itemize_state_add_character): Propagate context base_gravity into items.
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r--pango/pango-context.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 827b877f..fc199083 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -576,6 +576,7 @@ struct _ItemizeState
int embedding_end_offset;
const char *embedding_end;
guint8 embedding;
+ PangoGravity gravity;
PangoAttrIterator *attr_iter;
gboolean free_attr_iter;
@@ -701,6 +702,11 @@ itemize_state_init (ItemizeState *state,
state->embedding_end_offset = 0;
state->embedding_end = text + start_index;
update_embedding_end (state);
+
+ /* FIXME: Set gravity to base gravity for now, until we do
+ * proper gravity assignment.
+ */
+ state->gravity = context->base_gravity;
/* Initialize the attribute iterator
*/
@@ -867,6 +873,29 @@ itemize_state_add_character (ItemizeState *state,
state->item->analysis.font = font;
state->item->analysis.level = state->embedding;
+ state->item->analysis.gravity = state->gravity;
+ /* The level vs. gravity dance:
+ * - If gravity is NORTH, leave level untouched
+ * - If gravity is SOUTH, step level one up, to
+ * not get mirrored upside-down text
+ * - If gravity is WEST, leave level untouched, as
+ * it's a clockwise-rotated layout, so the rotated
+ * top is unrotated left.
+ * - If gravity is EAST, step level one up to get, as
+ * it's a counter-clockwise-rotated layout, so the rotated
+ * top is unrotated right.
+ */
+ switch (state->item->analysis.gravity)
+ {
+ case PANGO_GRAVITY_NORTH:
+ case PANGO_GRAVITY_WEST:
+ default:
+ break;
+ case PANGO_GRAVITY_SOUTH:
+ case PANGO_GRAVITY_EAST:
+ state->item->analysis.level++;
+ }
+
state->item->analysis.language = state->derived_lang;
if (state->copy_extra_attrs)