summaryrefslogtreecommitdiff
path: root/pango/pango-matrix.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-20 20:35:45 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-20 20:35:45 +0000
commitd166f21c486ecda8c67d94ec0392f837c5f3eea9 (patch)
tree48ea486638afadaf9d734c59f9bbb06102f5e4a0 /pango/pango-matrix.c
parent919d3089dae2e2ad011c9b94b4847c30b536ac63 (diff)
downloadpango-d166f21c486ecda8c67d94ec0392f837c5f3eea9.tar.gz
Correct switched return value of EAST/WEST.
2006-08-20 Behdad Esfahbod <behdad@gnome.org> * pango/pango-matrix.c (pango_matrix_to_gravity): Correct switched return value of EAST/WEST. * pango/pango-types.h (PangoGravity): Add PANGO_GRAVITY_AUTO. * pango/pango-context.h: Add pango_context_get_gravity(). * examples/renderdemo.c (parse_gravity), (parse_options): * pango/pango-context.c (pango_context_init), (update_resolved_gravity), (pango_context_set_matrix), (pango_context_set_base_gravity), (pango_context_get_gravity), (itemize_state_init), (get_shaper_and_font): * pango/pango-layout.c (line_set_resolved_dir): * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_metrics), (pango_cairo_fc_font_glyph_extents_cache_init), (_pango_cairo_fc_font_new): * pango/pangofc-fontmap.c (pango_fc_make_pattern), (pango_fc_font_map_load_fontset): * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/main.sgml: Update to above.
Diffstat (limited to 'pango/pango-matrix.c')
-rw-r--r--pango/pango-matrix.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index 322a4931..e63ecab1 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -258,7 +258,7 @@ pango_matrix_get_font_scale_factor (const PangoMatrix *matrix)
* in a #PangoMatrix.
*
* Return value: the gravity of @matrix, which will never be
- * %PANGO_GRAVITY_AUTO
+ * %PANGO_GRAVITY_AUTO, or PANGO_GRAVITY_SOUTH if @matrix is %NULL
*
* Since: 1.16
*/
@@ -266,11 +266,17 @@ PangoGravity
pango_matrix_to_gravity (const PangoMatrix *matrix)
{
PangoGravity gravity;
- double x = matrix->xy;
- double y = matrix->yy;
+ double x;
+ double y;
+
+ if (!matrix)
+ return PANGO_GRAVITY_SOUTH;
+
+ x = matrix->xy;
+ y = matrix->yy;
if (abs (x) > abs (y))
- gravity = x < 0 ? PANGO_GRAVITY_WEST : PANGO_GRAVITY_EAST;
+ gravity = x > 0 ? PANGO_GRAVITY_WEST : PANGO_GRAVITY_EAST;
else
gravity = y < 0 ? PANGO_GRAVITY_NORTH : PANGO_GRAVITY_SOUTH;