summaryrefslogtreecommitdiff
path: root/pango/pango-matrix.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-16 07:23:08 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-16 07:23:08 +0000
commitbb26941a468b994331286a55d41447cc2ef9326f (patch)
tree7e38be8a1800f49aeed0e0b54e8e74524124a46c /pango/pango-matrix.c
parent292545e94970319545d1a2d8a5ebb700ade67565 (diff)
downloadpango-bb26941a468b994331286a55d41447cc2ef9326f.tar.gz
Render block progression and line direction arrows, and a base gravity
2006-08-16 Behdad Esfahbod <behdad@gnome.org> * examples/viewer-pangocairo.c (render_callback): Render block progression and line direction arrows, and a base gravity roof-top. * pango/pango-matrix.c (pango_matrix_to_gravity): New function. * pango/pango-utils.c (pango_gravity_to_rotation): New function. * pango/pangocairo-fcfont.c (_pango_cairo_fc_font_new): Use pango_gravity_to_rotation(). * pango/pango-utils.h: * pango/pango-types.h: Reorder a bit. * examples/Makefile.am: * examples/test-chinese.txt: New test text for Chinese. * pango/check.defs: New script that checks that all the exported symbols are listed in the respective .def file. (only checks the libraries actually built. No win32 for example.) * pango/Makefile.am: Hook check.defs as a 'make check' test. * pango/pango.def: * pango/pangoft2.def: * pango/pangocairo.def: Update. * docs/tmpl/glyphs.sgml: * docs/tmpl/main.sgml: * docs/pango-sections.txt: Update.
Diffstat (limited to 'pango/pango-matrix.c')
-rw-r--r--pango/pango-matrix.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index 58be83e1..322a4931 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -20,6 +20,7 @@
*/
#include <config.h>
+#include <stdlib.h>
#include <math.h>
#include "pango-types.h"
@@ -248,3 +249,30 @@ pango_matrix_get_font_scale_factor (const PangoMatrix *matrix)
return minor;
}
}
+
+/**
+ * pango_matrix_to_gravity:
+ * @matrix: a #PangoMatrix
+ *
+ * Finds the gravity that best matches the rotation component
+ * in a #PangoMatrix.
+ *
+ * Return value: the gravity of @matrix, which will never be
+ * %PANGO_GRAVITY_AUTO
+ *
+ * Since: 1.16
+ */
+PangoGravity
+pango_matrix_to_gravity (const PangoMatrix *matrix)
+{
+ PangoGravity gravity;
+ double x = matrix->xy;
+ double y = matrix->yy;
+
+ if (abs (x) > abs (y))
+ gravity = x < 0 ? PANGO_GRAVITY_WEST : PANGO_GRAVITY_EAST;
+ else
+ gravity = y < 0 ? PANGO_GRAVITY_NORTH : PANGO_GRAVITY_SOUTH;
+
+ return gravity;
+}