~ubuntu-branches/ubuntu/maverick/pango1.0/maverick-proposed

« back to all changes in this revision

Viewing changes to pango/pangofc-private.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-11-18 07:40:39 UTC
  • mfrom: (1.5.8 upstream) (64.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091118074039-7d88ewja7jajppz6
Tags: 1.26.1-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
PangoFontMetrics *pango_fc_font_create_metrics_for_context (PangoFcFont   *font,
94
94
                                                            PangoContext  *context);
95
95
 
 
96
 
 
97
 
 
98
/* To be made public at some point */
 
99
 
 
100
#include <math.h>
 
101
 
 
102
static G_GNUC_UNUSED void
 
103
pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
 
104
                                     double *xscale, double *yscale)
 
105
{
 
106
/*
 
107
 * Based on cairo-matrix.c:_cairo_matrix_compute_scale_factors()
 
108
 *
 
109
 * Copyright 2005, Keith Packard
 
110
 */
 
111
  double major = 0, minor = 0;
 
112
 
 
113
  if (matrix) {
 
114
    double det = matrix->xx * matrix->yy - matrix->yx * matrix->xy;
 
115
 
 
116
    if (det)
 
117
      {
 
118
        double x = matrix->xx;
 
119
        double y = matrix->yx;
 
120
 
 
121
        major = sqrt (x*x + y*y);
 
122
 
 
123
        /*
 
124
         * ignore mirroring
 
125
         */
 
126
        if (det < 0)
 
127
          det = - det;
 
128
 
 
129
        if (major)
 
130
          minor = det / major;
 
131
      }
 
132
  }
 
133
 
 
134
  if (xscale)
 
135
    *xscale = major;
 
136
  if (yscale)
 
137
    *yscale = minor;
 
138
}
 
139
 
96
140
G_END_DECLS
97
141
 
98
142
#endif /* __PANGOFC_PRIVATE_H__ */