diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-08-16 07:57:51 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-08-16 07:57:51 +0000 |
commit | a103ced40aedc2a50624bd2f2b52fc68c70c44ec (patch) | |
tree | 094eda4914fe9a63ca0c390691d5f75272ceef22 /pango | |
parent | 46ff087263201f8c385d9ddc24176984ccca7f95 (diff) | |
download | pango-a103ced40aedc2a50624bd2f2b52fc68c70c44ec.tar.gz |
Adjust line resolved_dir according to context base_gravity, like we do in
2006-08-16 Behdad Esfahbod <behdad@gnome.org>
* pango/pango-layout.c (line_set_resolved_dir): Adjust line
resolved_dir according to context base_gravity, like we do
in itemize_state_add_character().
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-context.c | 8 | ||||
-rw-r--r-- | pango/pango-layout.c | 33 |
2 files changed, 39 insertions, 2 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c index 48c6980b..ac6db552 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -882,16 +882,20 @@ itemize_state_add_character (ItemizeState *state, state->item->analysis.level = state->embedding; state->item->analysis.gravity = state->gravity; + /* The level vs. gravity dance: - * - If gravity is SOUTH, leave level untouched + * - If gravity is SOUTH, leave level untouched. * - If gravity is NORTH, step level one up, to - * not get mirrored upside-down text + * not get mirrored upside-down text. * - If gravity is EAST, step up to an even level, as * it's a clockwise-rotated layout, so the rotated * top is unrotated left. * - If gravity is WEST, step up to an odd level, as * it's a counter-clockwise-rotated layout, so the rotated * top is unrotated right. + * + * A similar dance is performed in pango-layout.c: + * line_set_resolved_dir(). Keep in synch. */ switch (state->item->analysis.gravity) { diff --git a/pango/pango-layout.c b/pango/pango-layout.c index cb6e14d7..4c9ec92f 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -3014,6 +3014,39 @@ line_set_resolved_dir (PangoLayoutLine *line, line->resolved_dir = PANGO_DIRECTION_RTL; break; } + + /* The direction vs. gravity dance: + * - If gravity is SOUTH, leave direction untouched. + * - If gravity is NORTH, switch direction. + * - If gravity is EAST, set to LTR, as + * it's a clockwise-rotated layout, so the rotated + * top is unrotated left. + * - If gravity is WEST, set to RTL, as + * it's a counter-clockwise-rotated layout, so the rotated + * top is unrotated right. + * + * A similar dance is performed in pango-context.c: + * itemize_state_add_character(). Keep in synch. + */ + switch (pango_context_get_base_gravity (line->layout->context)) + { + case PANGO_GRAVITY_SOUTH: + default: + break; + case PANGO_GRAVITY_NORTH: + line->resolved_dir = PANGO_DIRECTION_LTR + + PANGO_DIRECTION_RTL + - line->resolved_dir; + break; + case PANGO_GRAVITY_EAST: + /* This is in fact why deprecated TTB_RTL is LTR */ + line->resolved_dir = PANGO_DIRECTION_LTR; + break; + case PANGO_GRAVITY_WEST: + /* This is in fact why deprecated TTB_LTR is RTL */ + line->resolved_dir = PANGO_DIRECTION_RTL; + break; + } } static void |