Code

- try to use more forward declarations for less dependencies on display/curve.h
[inkscape.git] / src / fontsize-expansion.cpp
1 #include "libnr/nr-matrix-ops.h"
3 /**
4  * Returns the distance from the transformed baseline to the
5  * transformation of a point at (0, 1); or 0 if \a m has no inverse.
6  */
7 double
8 fontsize_expansion(NR::Matrix const &m)
9 {
10     double const denom(hypot(m[0], m[1]));
11     if (!(denom > 1e-100)) {
12         return 0.;
13     }
14     double const numer(m.descrim2());
15     if (!(numer > 1e-100)) {
16         return 0.;
17     }
18     return numer / denom;
19 }
21 /*
22   Local Variables:
23   mode:c++
24   c-file-style:"stroustrup"
25   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
26   indent-tabs-mode:nil
27   fill-column:99
28   End:
29 */
30 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :