summaryrefslogtreecommitdiff
path: root/pango/pangofc-private.h
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-11-17 19:31:23 -0500
committerBehdad Esfahbod <behdad@behdad.org>2009-11-17 19:31:23 -0500
commitd9abcaf566e9cd7f702c98958f99f90fd53b4c0b (patch)
tree56795cbfc1a72f0c4b76fb456b97b1ac86e3bb7f /pango/pangofc-private.h
parent4ccabeffc20f899163bf610356871afb197e9bf8 (diff)
downloadpango-d9abcaf566e9cd7f702c98958f99f90fd53b4c0b.tar.gz
Bug 341481 - pangocairo kerning problem with nonidentity scaling
Finally fix this embarrassing bug. The fix is a kludge, but it will be redone for 1.28 (harfbuzz-ng) anyway.
Diffstat (limited to 'pango/pangofc-private.h')
-rw-r--r--pango/pangofc-private.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/pango/pangofc-private.h b/pango/pangofc-private.h
index 0612a692..e7c08bff 100644
--- a/pango/pangofc-private.h
+++ b/pango/pangofc-private.h
@@ -93,6 +93,50 @@ void pango_fc_font_get_raw_extents (PangoFcFont *font,
PangoFontMetrics *pango_fc_font_create_metrics_for_context (PangoFcFont *font,
PangoContext *context);
+
+
+/* To be made public at some point */
+
+#include <math.h>
+
+static G_GNUC_UNUSED void
+pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
+ double *xscale, double *yscale)
+{
+/*
+ * Based on cairo-matrix.c:_cairo_matrix_compute_scale_factors()
+ *
+ * Copyright 2005, Keith Packard
+ */
+ double major = 0, minor = 0;
+
+ if (matrix) {
+ double det = matrix->xx * matrix->yy - matrix->yx * matrix->xy;
+
+ if (det)
+ {
+ double x = matrix->xx;
+ double y = matrix->yx;
+
+ major = sqrt (x*x + y*y);
+
+ /*
+ * ignore mirroring
+ */
+ if (det < 0)
+ det = - det;
+
+ if (major)
+ minor = det / major;
+ }
+ }
+
+ if (xscale)
+ *xscale = major;
+ if (yscale)
+ *yscale = minor;
+}
+
G_END_DECLS
#endif /* __PANGOFC_PRIVATE_H__ */