summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--pango/pango-context.c29
-rw-r--r--pango/pango-item.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 07ef7f72..cbc9ad45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2006-08-15 Behdad Esfahbod <behdad@gnome.org>
+
* pango/pango-types.h: Add enum PangoGravity.
* pango/pango-context.h:
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)
diff --git a/pango/pango-item.h b/pango/pango-item.h
index f90443b8..90b9b614 100644
--- a/pango/pango-item.h
+++ b/pango/pango-item.h
@@ -35,6 +35,7 @@ struct _PangoAnalysis
PangoEngineLang *lang_engine;
PangoFont *font;
guint8 level;
+ PangoGravity gravity : 8; /* nastiest hack ever. stuff gravity in the padding after the guint8 */
PangoLanguage *language;
GSList *extra_attrs;
};