diff options
Diffstat (limited to 'pango/pangofc-private.h')
-rw-r--r-- | pango/pangofc-private.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/pango/pangofc-private.h b/pango/pangofc-private.h index b5fab578..7945962e 100644 --- a/pango/pangofc-private.h +++ b/pango/pangofc-private.h @@ -91,8 +91,52 @@ void pango_fc_font_get_raw_extents (PangoFcFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect); -PangoFontMetrics *pango_fc_font_create_metrics_for_context (PangoFcFont *font, - PangoContext *context); +PangoFontMetrics *pango_fc_font_create_base_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 |