Code

convert almost all libnrtype to Geom::
authorjohanengelen <johanengelen@users.sourceforge.net>
Thu, 11 Sep 2008 21:44:48 +0000 (21:44 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Thu, 11 Sep 2008 21:44:48 +0000 (21:44 +0000)
30 files changed:
src/desktop.cpp
src/desktop.h
src/display/nr-arena-glyphs.cpp
src/display/nr-arena-glyphs.h
src/gradient-chemistry.cpp
src/gradient-context.cpp
src/knot.cpp
src/libnrtype/FontInstance.cpp
src/libnrtype/Layout-TNG-Compute.cpp
src/libnrtype/Layout-TNG-OutIter.cpp
src/libnrtype/Layout-TNG-Output.cpp
src/libnrtype/Layout-TNG-Scanline-Makers.cpp
src/libnrtype/Layout-TNG.h
src/libnrtype/RasterFont.cpp
src/libnrtype/RasterFont.h
src/libnrtype/font-instance.h
src/libnrtype/font-style.h
src/libnrtype/raster-glyph.h
src/nodepath.cpp
src/rubberband.cpp
src/selcue.cpp
src/select-context.cpp
src/selection-chemistry.cpp
src/shape-editor.cpp
src/sp-text.cpp
src/text-context.cpp
src/text-editing.cpp
src/text-editing.h
src/ui/dialog/align-and-distribute.cpp
src/widgets/font-selector.cpp

index 54285c083c1cb7064f35f930b5914b4af8c17c7c..476f1e3d76acc9ea88b4b9bc8d79784b0fa205f9 100644 (file)
@@ -1038,7 +1038,7 @@ SPDesktop::scroll_world (double dx, double dy, bool is_scrolling)
 }
 
 bool
-SPDesktop::scroll_to_point (NR::Point const *p, gdouble autoscrollspeed)
+SPDesktop::scroll_to_point (Geom::Point const &p, gdouble autoscrollspeed)
 {
     gdouble autoscrolldistance = (gdouble) prefs_get_int_attribute_limited ("options.autoscrolldistance", "value", 0, -1000, 10000);
 
@@ -1046,26 +1046,26 @@ SPDesktop::scroll_to_point (NR::Point const *p, gdouble autoscrollspeed)
     autoscrolldistance /= expansion(_d2w);
     NR::Rect const dbox = NR::expand(get_display_area(), -autoscrolldistance);
 
-    if (!((*p)[NR::X] > dbox.min()[NR::X] && (*p)[NR::X] < dbox.max()[NR::X]) ||
-        !((*p)[NR::Y] > dbox.min()[NR::Y] && (*p)[NR::Y] < dbox.max()[NR::Y])   ) {
+    if (!(p[NR::X] > dbox.min()[NR::X] && p[NR::X] < dbox.max()[NR::X]) ||
+        !(p[NR::Y] > dbox.min()[NR::Y] && p[NR::Y] < dbox.max()[NR::Y])   ) {
 
-        NR::Point const s_w( (*p) * _d2w );
+        NR::Point const s_w( p * (Geom::Matrix)_d2w );
 
         gdouble x_to;
-        if ((*p)[NR::X] < dbox.min()[NR::X])
+        if (p[NR::X] < dbox.min()[NR::X])
             x_to = dbox.min()[NR::X];
-        else if ((*p)[NR::X] > dbox.max()[NR::X])
+        else if (p[NR::X] > dbox.max()[NR::X])
             x_to = dbox.max()[NR::X];
         else
-            x_to = (*p)[NR::X];
+            x_to = p[NR::X];
 
         gdouble y_to;
-        if ((*p)[NR::Y] < dbox.min()[NR::Y])
+        if (p[NR::Y] < dbox.min()[NR::Y])
             y_to = dbox.min()[NR::Y];
-        else if ((*p)[NR::Y] > dbox.max()[NR::Y])
+        else if (p[NR::Y] > dbox.max()[NR::Y])
             y_to = dbox.max()[NR::Y];
         else
-            y_to = (*p)[NR::Y];
+            y_to = p[NR::Y];
 
         NR::Point const d_dt(x_to, y_to);
         NR::Point const d_w( d_dt * _d2w );
index adb6cb98b1f67089c9877d5801ce7846be458912..8b7ecd98b818bfc71cb4a3780ebc2a548b07a0c7 100644 (file)
@@ -250,7 +250,7 @@ struct SPDesktop : public Inkscape::UI::View::View
     void prev_zoom();
     void next_zoom();
 
-    bool scroll_to_point (NR::Point const *s_dt, gdouble autoscrollspeed = 0);
+    bool scroll_to_point (Geom::Point const &s_dt, gdouble autoscrollspeed = 0);
     void scroll_world (double dx, double dy, bool is_scrolling = false);
     void scroll_world (NR::Point const scroll, bool is_scrolling = false)
     {
index 0216fe4f96f53e8f8a354f716320b47ac1c6cb76..6bb64f8d09c6b8575a9485328f374c2fed98e3b5 100644 (file)
@@ -255,7 +255,7 @@ nr_arena_glyphs_pick(NRArenaItem *item, NR::Point p, gdouble /*delta*/, unsigned
 }
 
 void
-nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, NR::Matrix const *transform)
+nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, Geom::Matrix const *transform)
 {
     nr_return_if_fail(glyphs != NULL);
     nr_return_if_fail(NR_IS_ARENA_GLYPHS(glyphs));
@@ -607,7 +607,7 @@ nr_arena_glyphs_group_clear(NRArenaGlyphsGroup *sg)
 }
 
 void
-nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NR::Matrix const *transform)
+nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, Geom::Matrix const &transform)
 {
     NRArenaGroup *group;
 
@@ -622,7 +622,7 @@ nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font,
         NRArenaItem *new_arena = NRArenaGlyphs::create(group->arena);
         nr_arena_item_append_child(NR_ARENA_ITEM(group), new_arena);
         nr_arena_item_unref(new_arena);
-        nr_arena_glyphs_set_path(NR_ARENA_GLYPHS(new_arena), NULL, FALSE, font, glyph, transform);
+        nr_arena_glyphs_set_path(NR_ARENA_GLYPHS(new_arena), NULL, FALSE, font, glyph, &transform);
         nr_arena_glyphs_set_style(NR_ARENA_GLYPHS(new_arena), sg->style);
     }
 }
index ebf5cee6d3646910f2b151742ce26ff3c43e5989..9c6762363c80c29ff12df15aa0392fc881681310 100644 (file)
@@ -59,10 +59,10 @@ struct NRArenaGlyphsClass {
        NRArenaItemClass parent_class;
 };
 
-void nr_arena_glyphs_set_path (NRArenaGlyphs *glyphs,
-                              SPCurve *curve, unsigned int lieutenant,
-                              font_instance *font, int glyph,
-                              const NR::Matrix *transform);
+void nr_arena_glyphs_set_path ( NRArenaGlyphs *glyphs,
+                                SPCurve *curve, unsigned int lieutenant,
+                                font_instance *font, int glyph,
+                                Geom::Matrix const *transform   );
 void nr_arena_glyphs_set_style (NRArenaGlyphs *glyphs, SPStyle *style);
 
 /* Integrated group of component glyphss */
@@ -100,7 +100,7 @@ struct NRArenaGlyphsGroupClass {
 
 void nr_arena_glyphs_group_clear (NRArenaGlyphsGroup *group);
 
-void nr_arena_glyphs_group_add_component (NRArenaGlyphsGroup *group, font_instance *font, int glyph, const NR::Matrix *transform);
+void nr_arena_glyphs_group_add_component (NRArenaGlyphsGroup *group, font_instance *font, int glyph, Geom::Matrix const &transform);
 
 void nr_arena_glyphs_group_set_style (NRArenaGlyphsGroup *group, SPStyle *style);
 
index afbf1600944cbaef69ff4e1ab7461e8a9d860cfd..26945def604e8ca2ba0849417c8cbf43cbc06e8b 100644 (file)
@@ -31,6 +31,9 @@
 #include "sp-tspan.h"
 #include <libnr/nr-matrix-fns.h>
 #include <libnr/nr-point-fns.h>
+#include <libnr/nr-matrix-ops.h>
+#include <libnr/nr-rotate-ops.h>
+#include <2geom/transforms.h>
 #include "xml/repr.h"
 #include "svg/svg.h"
 #include "svg/svg-color.h"
@@ -299,9 +302,9 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
         sp_repr_set_svg_double(repr, "r", width/2);
 
         // we want it to be elliptic, not circular
-        NR::Matrix squeeze = NR::Matrix (NR::translate (-center)) *
-            NR::Matrix (NR::scale(1, height/width)) *
-            NR::Matrix (NR::translate (center));
+        Geom::Matrix squeeze = Geom::Translate (-center) *
+            Geom::Scale(1, height/width) *
+            Geom::Translate (center);
 
         gr->gradientTransform = squeeze;
         {
index e6932c71004cef1aed92394adaa3f99ab9a16166..400661ce23901c673beb5dd09fe81c44ff60edd0 100644 (file)
@@ -225,7 +225,7 @@ sp_gradient_context_select_next (SPEventContext *event_context)
 
     GrDragger *d = drag->select_next();
 
-    event_context->desktop->scroll_to_point(&(d->point), 1.0);
+    event_context->desktop->scroll_to_point(d->point, 1.0);
 }
 
 void
@@ -236,7 +236,7 @@ sp_gradient_context_select_prev (SPEventContext *event_context)
 
     GrDragger *d = drag->select_prev();
 
-    event_context->desktop->scroll_to_point(&(d->point), 1.0);
+    event_context->desktop->scroll_to_point(d->point, 1.0);
 }
 
 static bool
index 1584769b4613b98669e1f24da01f8d759f2cfe83..59e32a56ecefc48dec723bf3bcb429c8139fa3be 100644 (file)
@@ -381,7 +381,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
                 NR::Point const motion_dt = knot->desktop->w2d(motion_w);
                 Geom::Point p = motion_dt - knot->grabbed_rel_pos;
                 sp_knot_request_position (knot, p, event->motion.state);
-                knot->desktop->scroll_to_point (&motion_dt);
+                knot->desktop->scroll_to_point (motion_dt);
                 knot->desktop->set_coordinate_status(knot->pos); // display the coordinate of knot, not cursor - they may be different!
                 if (event->motion.state & GDK_BUTTON1_MASK)
                     gobble_motion_events(GDK_BUTTON1_MASK);
index 4f745c0f946d85859d2829555e86e30f16c80a48..25a6af935157b3ddd2a1242309e534852bf5374f 100644 (file)
@@ -87,7 +87,7 @@ bool  font_style_equal::operator()(const font_style &a,const font_style &b) {
 typedef struct ft2_to_liv {
        Path*        theP;
        double       scale;
-       NR::Point    last;
+       Geom::Point    last;
 } ft2_to_liv;
 
 // Note: Freetype 2.2.1 redefined function signatures for functions to be placed in an
@@ -105,7 +105,7 @@ typedef FT_Vector FREETYPE_VECTOR;
 // see nr-type-ft2.cpp for the freetype -> artBPath on which this code is based
 static int ft2_move_to(FREETYPE_VECTOR *to, void * i_user) {
        ft2_to_liv* user=(ft2_to_liv*)i_user;
-       NR::Point   p(user->scale*to->x,user->scale*to->y);
+       Geom::Point   p(user->scale*to->x,user->scale*to->y);
        //      printf("m  t=%f %f\n",p[0],p[1]);
        user->theP->MoveTo(p);
        user->last=p;
@@ -115,7 +115,7 @@ static int ft2_move_to(FREETYPE_VECTOR *to, void * i_user) {
 static int ft2_line_to(FREETYPE_VECTOR *to, void *i_user)
 {
        ft2_to_liv* user=(ft2_to_liv*)i_user;
-       NR::Point   p(user->scale*to->x,user->scale*to->y);
+       Geom::Point   p(user->scale*to->x,user->scale*to->y);
        //      printf("l  t=%f %f\n",p[0],p[1]);
        user->theP->LineTo(p);
        user->last=p;
@@ -125,7 +125,7 @@ static int ft2_line_to(FREETYPE_VECTOR *to, void *i_user)
 static int ft2_conic_to(FREETYPE_VECTOR *control, FREETYPE_VECTOR *to, void *i_user)
 {
        ft2_to_liv* user=(ft2_to_liv*)i_user;
-       NR::Point   p(user->scale*to->x,user->scale*to->y),c(user->scale*control->x,user->scale*control->y);
+       Geom::Point   p(user->scale*to->x,user->scale*to->y),c(user->scale*control->x,user->scale*control->y);
        //      printf("b c=%f %f  t=%f %f\n",c[0],c[1],p[0],p[1]);
        user->theP->BezierTo(p);
        user->theP->IntermBezierTo(c);
@@ -137,7 +137,7 @@ static int ft2_conic_to(FREETYPE_VECTOR *control, FREETYPE_VECTOR *to, void *i_u
 static int ft2_cubic_to(FREETYPE_VECTOR *control1, FREETYPE_VECTOR *control2, FREETYPE_VECTOR *to, void *i_user)
 {
        ft2_to_liv* user=(ft2_to_liv*)i_user;
-       NR::Point   p(user->scale*to->x,user->scale*to->y),
+       Geom::Point   p(user->scale*to->x,user->scale*to->y),
        c1(user->scale*control1->x,user->scale*control1->y),
        c2(user->scale*control2->x,user->scale*control2->y);
        //      printf("c c1=%f %f  c2=%f %f   t=%f %f\n",c1[0],c1[1],c2[0],c2[1],p[0],p[1]);
@@ -407,9 +407,9 @@ int font_instance::MapUnicodeChar(gunichar c)
 
 
 #ifdef USE_PANGO_WIN32
-static inline NR::Point pointfx_to_nrpoint(const POINTFX &p, double scale)
+static inline Geom::Point pointfx_to_nrpoint(const POINTFX &p, double scale)
 {
-    return NR::Point(*(long*)&p.x / 65536.0 * scale,
+    return Geom::Point(*(long*)&p.x / 65536.0 * scale,
                      *(long*)&p.y / 65536.0 * scale);
 }
 #endif
@@ -486,9 +486,9 @@ void font_instance::LoadGlyph(int glyph_id)
                                 {
                                     g_assert(polyCurve->cpfx >= 2);
                                     endp -= 2;
-                                    NR::Point this_mid=pointfx_to_nrpoint(p[0], scale);
+                                    Geom::Point this_mid=pointfx_to_nrpoint(p[0], scale);
                                     while ( p != endp ) {
-                                        NR::Point next_mid=pointfx_to_nrpoint(p[1], scale);
+                                        Geom::Point next_mid=pointfx_to_nrpoint(p[1], scale);
                                            n_g.outline->BezierTo((next_mid+this_mid)/2);
                                            n_g.outline->IntermBezierTo(this_mid);
                                            n_g.outline->EndBezierTo();
@@ -546,7 +546,7 @@ void font_instance::LoadGlyph(int glyph_id)
                                ft2_to_liv   tData;
                                tData.theP=n_g.outline;
                                tData.scale=1.0/((double)theFace->units_per_EM);
-                               tData.last=NR::Point(0,0);
+                               tData.last=Geom::Point(0,0);
                                FT_Outline_Decompose (&theFace->glyph->outline, &ft2_outline_funcs, &tData);
                        }
                        doAdd=true;
@@ -613,7 +613,7 @@ bool font_instance::FontSlope(double &run, double &rise)
        return true;
 }
 
-boost::optional<NR::Rect> font_instance::BBox(int glyph_id)
+boost::optional<Geom::Rect> font_instance::BBox(int glyph_id)
 {
        int no=-1;
        if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
@@ -627,11 +627,11 @@ boost::optional<NR::Rect> font_instance::BBox(int glyph_id)
                no=id_to_no[glyph_id];
        }
        if ( no < 0 ) {
-            return boost::optional<NR::Rect>();
+            return boost::optional<Geom::Rect>();
         } else {
-           NR::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]);
-           NR::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]);
-           return NR::Rect(rmin, rmax);
+           Geom::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]);
+           Geom::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]);
+           return Geom::Rect(rmin, rmax);
         }
 }
 
@@ -699,7 +699,7 @@ double font_instance::Advance(int glyph_id,bool vertical)
 }
 
 
-raster_font* font_instance::RasterFont(const NR::Matrix &trs, double stroke_width, bool vertical, JoinType stroke_join, ButtType stroke_cap, float /*miter_limit*/)
+raster_font* font_instance::RasterFont(const Geom::Matrix &trs, double stroke_width, bool vertical, JoinType stroke_join, ButtType stroke_cap, float /*miter_limit*/)
 {
        font_style  nStyle;
        nStyle.transform=trs;
index 96ea2be7c9032978f5f0b16c604ab6230fe18d7f..57be6033a79419d550ff42f4dea6d1ce713fded8 100644 (file)
@@ -1469,7 +1469,7 @@ bool Layout::Calculator::calculate()
 
 void Layout::_calculateCursorShapeForEmpty()
 {
-    _empty_cursor_shape.position = NR::Point(0, 0);
+    _empty_cursor_shape.position = Geom::Point(0, 0);
     _empty_cursor_shape.height = 0.0;
     _empty_cursor_shape.rotation = 0.0;
     if (_input_stream.empty() || _input_stream.front()->Type() != TEXT_SOURCE)
@@ -1496,7 +1496,7 @@ void Layout::_calculateCursorShapeForEmpty()
     _empty_cursor_shape.rotation = caret_slope;
 
     if (_input_wrap_shapes.empty()) {
-        _empty_cursor_shape.position = NR::Point(text_source->x.empty() || !text_source->x.front()._set ? 0.0 : text_source->x.front().computed,
+        _empty_cursor_shape.position = Geom::Point(text_source->x.empty() || !text_source->x.front()._set ? 0.0 : text_source->x.front().computed,
                                                  text_source->y.empty() || !text_source->y.front()._set ? 0.0 : text_source->y.front().computed);
     } else {
         Direction block_progression = text_source->styleGetBlockProgression();
@@ -1504,9 +1504,9 @@ void Layout::_calculateCursorShapeForEmpty()
         std::vector<ScanlineMaker::ScanRun> scan_runs = scanline_maker.makeScanline(line_height);
         if (!scan_runs.empty()) {
             if (block_progression == LEFT_TO_RIGHT || block_progression == RIGHT_TO_LEFT)
-                _empty_cursor_shape.position = NR::Point(scan_runs.front().y + font_size, scan_runs.front().x_start);
+                _empty_cursor_shape.position = Geom::Point(scan_runs.front().y + font_size, scan_runs.front().x_start);
             else
-                _empty_cursor_shape.position = NR::Point(scan_runs.front().x_start, scan_runs.front().y + font_size);
+                _empty_cursor_shape.position = Geom::Point(scan_runs.front().x_start, scan_runs.front().y + font_size);
         }
     }
 }
index 84307c9cea2ceb1522c4f1878a3b4f4b690d9771..abe28200530d5cf003f0e6fb1eca2974aa41f9fe 100644 (file)
@@ -12,8 +12,7 @@
 #include "livarot/Path.h"
 #include "font-instance.h"
 #include "svg/svg-length.h"
-#include "libnr/nr-matrix-translate-ops.h"
-#include "libnr/nr-translate-rotate-ops.h"
+#include <2geom/transforms.h>
 #include "style.h"
 
 namespace Inkscape {
@@ -86,7 +85,7 @@ Layout::iterator Layout::getNearestCursorPositionTo(double x, double y) const
     double local_y = y;
 
     if (_path_fitted) {
-        Path::cut_position position = const_cast<Path*>(_path_fitted)->PointToCurvilignPosition(NR::Point(x, y));
+        Path::cut_position position = const_cast<Path*>(_path_fitted)->PointToCurvilignPosition(Geom::Point(x, y));
         local_x = const_cast<Path*>(_path_fitted)->PositionToLength(position.piece, position.t);
         return _cursorXOnLineToIterator(0, local_x + _chunks.front().left_x);
     }
@@ -157,11 +156,11 @@ Layout::iterator Layout::getNearestCursorPositionTo(double x, double y) const
 
 Layout::iterator Layout::getLetterAt(double x, double y) const
 {
-    NR::Point point(x, y);
+    Geom::Point point(x, y);
 
     double rotation;
     for (iterator it = begin() ; it != end() ; it.nextCharacter()) {
-        NR::Rect box = characterBoundingBox(it, &rotation);
+        Geom::Rect box = characterBoundingBox(it, &rotation);
         // todo: rotation
         if (box.contains(point)) return it;
     }
@@ -201,20 +200,20 @@ Layout::iterator Layout::sourceToIterator(void *source_cookie) const
     return sourceToIterator(source_cookie, Glib::ustring::const_iterator(std::string::const_iterator(NULL)));
 }
 
-boost::optional<NR::Rect> Layout::glyphBoundingBox(iterator const &it, double *rotation) const
+boost::optional<Geom::Rect> Layout::glyphBoundingBox(iterator const &it, double *rotation) const
 {
    if (rotation) *rotation = _glyphs[it._glyph_index].rotation;
    return _glyphs[it._glyph_index].span(this).font->BBox(_glyphs[it._glyph_index].glyph);
 }
 
-NR::Point Layout::characterAnchorPoint(iterator const &it) const
+Geom::Point Layout::characterAnchorPoint(iterator const &it) const
 {
     if (_characters.empty())
         return _empty_cursor_shape.position;
     if (it._char_index == _characters.size()) {
-        return NR::Point(_chunks.back().left_x + _spans.back().x_end, _lines.back().baseline_y + _spans.back().baseline_shift);
+        return Geom::Point(_chunks.back().left_x + _spans.back().x_end, _lines.back().baseline_y + _spans.back().baseline_shift);
     } else {
-        return NR::Point(_characters[it._char_index].chunk(this).left_x
+        return Geom::Point(_characters[it._char_index].chunk(this).left_x
                              + _spans[_characters[it._char_index].in_span].x_start
                              + _characters[it._char_index].x,
                          _characters[it._char_index].line(this).baseline_y
@@ -222,12 +221,12 @@ NR::Point Layout::characterAnchorPoint(iterator const &it) const
     }
 }
 
-NR::Point Layout::chunkAnchorPoint(iterator const &it) const
+Geom::Point Layout::chunkAnchorPoint(iterator const &it) const
 {
     unsigned chunk_index;
 
     if (_chunks.empty())
-        return NR::Point(0.0, 0.0);
+        return Geom::Point(0.0, 0.0);
 
     if (_characters.empty())
         chunk_index = 0;
@@ -237,18 +236,18 @@ NR::Point Layout::chunkAnchorPoint(iterator const &it) const
 
     Alignment alignment = _paragraphs[_lines[_chunks[chunk_index].in_line].in_paragraph].alignment;
     if (alignment == LEFT || alignment == FULL)
-        return NR::Point(_chunks[chunk_index].left_x, _lines[chunk_index].baseline_y);
+        return Geom::Point(_chunks[chunk_index].left_x, _lines[chunk_index].baseline_y);
 
     double chunk_width = _getChunkWidth(chunk_index);
     if (alignment == RIGHT)
-        return NR::Point(_chunks[chunk_index].left_x + chunk_width, _lines[chunk_index].baseline_y);
+        return Geom::Point(_chunks[chunk_index].left_x + chunk_width, _lines[chunk_index].baseline_y);
     //centre
-    return NR::Point(_chunks[chunk_index].left_x + chunk_width * 0.5, _lines[chunk_index].baseline_y);
+    return Geom::Point(_chunks[chunk_index].left_x + chunk_width * 0.5, _lines[chunk_index].baseline_y);
 }
 
-NR::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) const
+Geom::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) const
 {
-    NR::Point top_left, bottom_right;
+    Geom::Point top_left, bottom_right;
     unsigned char_index = it._char_index;
 
     if (_path_fitted) {
@@ -266,11 +265,11 @@ NR::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) cons
             Span const &span = _characters[char_index].span(this);
 
             const_cast<Path*>(_path_fitted)->PointAndTangentAt(midpoint_otp[0].piece, midpoint_otp[0].t, midpoint, tangent);
-            top_left[NR::X] = midpoint[NR::X] - cluster_half_width;
-            top_left[NR::Y] = midpoint[NR::Y] - span.line_height.ascent;
-            bottom_right[NR::X] = midpoint[NR::X] + cluster_half_width;
-            bottom_right[NR::Y] = midpoint[NR::Y] + span.line_height.descent;
-            NR::Point normal = tangent.cw();
+            top_left[Geom::X] = midpoint[Geom::X] - cluster_half_width;
+            top_left[Geom::Y] = midpoint[Geom::Y] - span.line_height.ascent;
+            bottom_right[Geom::X] = midpoint[Geom::X] + cluster_half_width;
+            bottom_right[Geom::Y] = midpoint[Geom::Y] + span.line_height.descent;
+            Geom::Point normal = tangent.cw();
             top_left += span.baseline_shift * normal;
             bottom_right += span.baseline_shift * normal;
             if (rotation)
@@ -279,27 +278,27 @@ NR::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) cons
         g_free(midpoint_otp);
     } else {
         if (it._char_index == _characters.size()) {
-            top_left[NR::X] = bottom_right[NR::X] = _chunks.back().left_x + _spans.back().x_end;
+            top_left[Geom::X] = bottom_right[Geom::X] = _chunks.back().left_x + _spans.back().x_end;
             char_index--;
         } else {
             double span_x = _spans[_characters[it._char_index].in_span].x_start + _characters[it._char_index].chunk(this).left_x;
-            top_left[NR::X] = span_x + _characters[it._char_index].x;
+            top_left[Geom::X] = span_x + _characters[it._char_index].x;
             if (it._char_index + 1 == _characters.size() || _characters[it._char_index + 1].in_span != _characters[it._char_index].in_span)
-                bottom_right[NR::X] = _spans[_characters[it._char_index].in_span].x_end + _characters[it._char_index].chunk(this).left_x;
+                bottom_right[Geom::X] = _spans[_characters[it._char_index].in_span].x_end + _characters[it._char_index].chunk(this).left_x;
             else
-                bottom_right[NR::X] = span_x + _characters[it._char_index + 1].x;
+                bottom_right[Geom::X] = span_x + _characters[it._char_index + 1].x;
         }
 
         double baseline_y = _characters[char_index].line(this).baseline_y + _characters[char_index].span(this).baseline_shift;
         if (_directions_are_orthogonal(_blockProgression(), TOP_TO_BOTTOM)) {
             double span_height = _spans[_characters[char_index].in_span].line_height.ascent + _spans[_characters[char_index].in_span].line_height.descent;
-            top_left[NR::Y] = top_left[NR::X];
-            top_left[NR::X] = baseline_y - span_height * 0.5;
-            bottom_right[NR::Y] = bottom_right[NR::X];
-            bottom_right[NR::X] = baseline_y + span_height * 0.5;
+            top_left[Geom::Y] = top_left[Geom::X];
+            top_left[Geom::X] = baseline_y - span_height * 0.5;
+            bottom_right[Geom::Y] = bottom_right[Geom::X];
+            bottom_right[Geom::X] = baseline_y + span_height * 0.5;
         } else {
-            top_left[NR::Y] = baseline_y - _spans[_characters[char_index].in_span].line_height.ascent;
-            bottom_right[NR::Y] = baseline_y + _spans[_characters[char_index].in_span].line_height.descent;
+            top_left[Geom::Y] = baseline_y - _spans[_characters[char_index].in_span].line_height.ascent;
+            bottom_right[Geom::Y] = baseline_y + _spans[_characters[char_index].in_span].line_height.descent;
         }
 
         if (rotation) {
@@ -312,12 +311,12 @@ NR::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) cons
         }
     }
 
-    return NR::Rect(top_left, bottom_right);
+    return Geom::Rect(top_left, bottom_right);
 }
 
-std::vector<NR::Point> Layout::createSelectionShape(iterator const &it_start, iterator const &it_end, NR::Matrix const &transform) const
+std::vector<Geom::Point> Layout::createSelectionShape(iterator const &it_start, iterator const &it_end, Geom::Matrix const &transform) const
 {
-    std::vector<NR::Point> quads;
+    std::vector<Geom::Point> quads;
     unsigned char_index;
     unsigned end_char_index;
     
@@ -336,53 +335,53 @@ std::vector<NR::Point> Layout::createSelectionShape(iterator const &it_start, it
         double char_rotation = _glyphs[_characters[char_index].in_glyph].rotation;
         unsigned span_index = _characters[char_index].in_span;
 
-        NR::Point top_left, bottom_right;
+        Geom::Point top_left, bottom_right;
         if (_path_fitted || char_rotation != 0.0) {
-            NR::Rect box = characterBoundingBox(iterator(this, char_index), &char_rotation);
+            Geom::Rect box = characterBoundingBox(iterator(this, char_index), &char_rotation);
             top_left = box.min();
             bottom_right = box.max();
             char_index++;
         } else {   // for straight text we can be faster by combining all the character boxes in a span into one box
             double span_x = _spans[span_index].x_start + _spans[span_index].chunk(this).left_x;
-            top_left[NR::X] = span_x + _characters[char_index].x;
+            top_left[Geom::X] = span_x + _characters[char_index].x;
             while (char_index < end_char_index && _characters[char_index].in_span == span_index)
                 char_index++;
             if (char_index == _characters.size() || _characters[char_index].in_span != span_index)
-                bottom_right[NR::X] = _spans[span_index].x_end + _spans[span_index].chunk(this).left_x;
+                bottom_right[Geom::X] = _spans[span_index].x_end + _spans[span_index].chunk(this).left_x;
             else
-                bottom_right[NR::X] = span_x + _characters[char_index].x;
+                bottom_right[Geom::X] = span_x + _characters[char_index].x;
 
             double baseline_y = _spans[span_index].line(this).baseline_y + _spans[span_index].baseline_shift;
             if (_directions_are_orthogonal(_blockProgression(), TOP_TO_BOTTOM)) {
                 double span_height = _spans[span_index].line_height.ascent + _spans[span_index].line_height.descent;
-                top_left[NR::Y] = top_left[NR::X];
-                top_left[NR::X] = baseline_y - span_height * 0.5;
-                bottom_right[NR::Y] = bottom_right[NR::X];
-                bottom_right[NR::X] = baseline_y + span_height * 0.5;
+                top_left[Geom::Y] = top_left[Geom::X];
+                top_left[Geom::X] = baseline_y - span_height * 0.5;
+                bottom_right[Geom::Y] = bottom_right[Geom::X];
+                bottom_right[Geom::X] = baseline_y + span_height * 0.5;
             } else {
-                top_left[NR::Y] = baseline_y - _spans[span_index].line_height.ascent;
-                bottom_right[NR::Y] = baseline_y + _spans[span_index].line_height.descent;
+                top_left[Geom::Y] = baseline_y - _spans[span_index].line_height.ascent;
+                bottom_right[Geom::Y] = baseline_y + _spans[span_index].line_height.descent;
             }
         }
 
-        NR::Rect char_box(top_left, bottom_right);
-        if (char_box.extent(NR::X) == 0.0 || char_box.extent(NR::Y) == 0.0)
+        Geom::Rect char_box(top_left, bottom_right);
+        if (char_box.dimensions()[Geom::X] == 0.0 || char_box.dimensions()[Geom::Y] == 0.0)
             continue;
-        NR::Point center_of_rotation((top_left[NR::X] + bottom_right[NR::X]) * 0.5,
-                                     top_left[NR::Y] + _spans[span_index].line_height.ascent);
-        NR::Matrix total_transform = NR::translate(-center_of_rotation) * NR::rotate(char_rotation) * NR::translate(center_of_rotation) * transform;
+        Geom::Point center_of_rotation((top_left[Geom::X] + bottom_right[Geom::X]) * 0.5,
+                                     top_left[Geom::Y] + _spans[span_index].line_height.ascent);
+        Geom::Matrix total_transform = Geom::Translate(-center_of_rotation) * Geom::Rotate(char_rotation) * Geom::Translate(center_of_rotation) * transform;
         for(int i = 0; i < 4; i ++)
             quads.push_back(char_box.corner(i) * total_transform);
     }
     return quads;
 }
 
-void Layout::queryCursorShape(iterator const &it, NR::Point *position, double *height, double *rotation) const
+void Layout::queryCursorShape(iterator const &it, Geom::Point &position, double &height, double &rotation) const
 {
     if (_characters.empty()) {
-        *position = _empty_cursor_shape.position;
-        *height = _empty_cursor_shape.height;
-        *rotation = _empty_cursor_shape.rotation;
+        position = _empty_cursor_shape.position;
+        height = _empty_cursor_shape.height;
+        rotation = _empty_cursor_shape.rotation;
     } else {
         // we want to cursor to be positioned where the left edge of a character that is about to be typed will be.
         // this means x & rotation are the current values but y & height belong to the previous character.
@@ -423,43 +422,47 @@ void Layout::queryCursorShape(iterator const &it, NR::Point *position, double *h
                 point += x * tangent;
             if (x > path_length )
                 point += (x - path_length) * tangent;
-            *rotation = atan2(tangent);
-            (*position)[NR::X] = point[NR::X] - tangent[NR::Y] * span->baseline_shift;
-            (*position)[NR::Y] = point[NR::Y] + tangent[NR::X] * span->baseline_shift;
+            rotation = atan2(tangent);
+            position[Geom::X] = point[Geom::X] - tangent[Geom::Y] * span->baseline_shift;
+            position[Geom::Y] = point[Geom::Y] + tangent[Geom::X] * span->baseline_shift;
         } else {
             // text is not on a path
             if (it._char_index >= _characters.size()) {
                 span = &_spans.back();
-                (*position)[NR::X] = _chunks[span->in_chunk].left_x + span->x_end;
-                *rotation = _glyphs.empty() ? 0.0 : _glyphs.back().rotation;
+                position[Geom::X] = _chunks[span->in_chunk].left_x + span->x_end;
+                rotation = _glyphs.empty() ? 0.0 : _glyphs.back().rotation;
             } else {
                 span = &_spans[_characters[it._char_index].in_span];
-                (*position)[NR::X] = _chunks[span->in_chunk].left_x + span->x_start + _characters[it._char_index].x;
-                if (it._glyph_index == -1) *rotation = 0.0;
-                else if(it._glyph_index == 0) *rotation = _glyphs[0].rotation;
-                else *rotation = _glyphs[it._glyph_index - 1].rotation;
+                position[Geom::X] = _chunks[span->in_chunk].left_x + span->x_start + _characters[it._char_index].x;
+                if (it._glyph_index == -1) {
+                    rotation = 0.0;
+                } else if(it._glyph_index == 0) {
+                    rotation = _glyphs[0].rotation;
+                } else{
+                    rotation = _glyphs[it._glyph_index - 1].rotation;
+                }
                 // the first char in a line wants to have the y of the new line, so in that case we don't switch to the previous span
                 if (it._char_index != 0 && _characters[it._char_index - 1].chunk(this).in_line == _chunks[span->in_chunk].in_line)
                     span = &_spans[_characters[it._char_index - 1].in_span];
             }
-            (*position)[NR::Y] = span->line(this).baseline_y + span->baseline_shift;
+            position[Geom::Y] = span->line(this).baseline_y + span->baseline_shift;
         }
         // up to now *position is the baseline point, not the final point which will be the bottom of the descent
         if (_directions_are_orthogonal(_blockProgression(), TOP_TO_BOTTOM)) {
-            *height = span->line_height.ascent + span->line_height.descent;
-            *rotation += M_PI / 2;
-            std::swap((*position)[NR::X], (*position)[NR::Y]);
-            (*position)[NR::X] -= sin(*rotation) * *height * 0.5;
-            (*position)[NR::Y] += cos(*rotation) * *height * 0.5;
+            height = span->line_height.ascent + span->line_height.descent;
+            rotation += M_PI / 2;
+            std::swap(position[Geom::X], position[Geom::Y]);
+            position[Geom::X] -= sin(rotation) * height * 0.5;
+            position[Geom::Y] += cos(rotation) * height * 0.5;
         } else {
             double caret_slope_run = 0.0, caret_slope_rise = 1.0;
             if (span->font)
                 const_cast<font_instance*>(span->font)->FontSlope(caret_slope_run, caret_slope_rise);
             double caret_slope = atan2(caret_slope_run, caret_slope_rise);
-            *height = (span->line_height.ascent + span->line_height.descent) / cos(caret_slope);
-            *rotation += caret_slope;
-            (*position)[NR::X] -= sin(*rotation) * span->line_height.descent;
-            (*position)[NR::Y] += cos(*rotation) * span->line_height.descent;
+            height = (span->line_height.ascent + span->line_height.descent) / cos(caret_slope);
+            rotation += caret_slope;
+            position[Geom::X] -= sin(rotation) * span->line_height.descent;
+            position[Geom::Y] += cos(rotation) * span->line_height.descent;
         }
     }
 }
index a3857b476a7f503287403489bb17b857f59e4075..d4df3ee37517191a8ef465fee46910a5b8fd9cc7 100644 (file)
@@ -59,7 +59,7 @@ void Layout::LineHeight::max(LineHeight const &other)
     if (other.leading > leading) leading = other.leading;
 }
 
-void Layout::_getGlyphTransformMatrix(int glyph_index, NR::Matrix *matrix) const
+void Layout::_getGlyphTransformMatrix(int glyph_index, Geom::Matrix *matrix) const
 {
     Span const &span = _glyphs[glyph_index].span(this);
     double sin_rotation = sin(_glyphs[glyph_index].rotation);
@@ -90,9 +90,9 @@ void Layout::show(NRArenaGroup *in_arena, NRRect const *paintbox) const
         nr_arena_glyphs_group_set_style(nr_group, text_source->style);
         while (glyph_index < (int)_glyphs.size() && _characters[_glyphs[glyph_index].in_character].in_span == span_index) {
             if (_characters[_glyphs[glyph_index].in_character].in_glyph != -1) {
-                NR::Matrix glyph_matrix;
+                Geom::Matrix glyph_matrix;
                 _getGlyphTransformMatrix(glyph_index, &glyph_matrix);
-                nr_arena_glyphs_group_add_component(nr_group, _spans[span_index].font, _glyphs[glyph_index].glyph, &glyph_matrix);
+                nr_arena_glyphs_group_add_component(nr_group, _spans[span_index].font, _glyphs[glyph_index].glyph, glyph_matrix);
             }
             glyph_index++;
         }
@@ -101,7 +101,7 @@ void Layout::show(NRArenaGroup *in_arena, NRRect const *paintbox) const
     nr_arena_item_request_update(NR_ARENA_ITEM(in_arena), NR_ARENA_ITEM_STATE_ALL, FALSE);
 }
 
-void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, int start, int length) const
+void Layout::getBoundingBox(NRRect *bounding_box, Geom::Matrix const &transform, int start, int length) const
 {
     for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; glyph_index++) {
         if (_characters[_glyphs[glyph_index].in_character].in_glyph == -1) continue;
@@ -112,20 +112,20 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i
             if ((int) _glyphs[glyph_index].in_character > start + length) continue;
         }
         // this could be faster
-        NR::Matrix glyph_matrix;
+        Geom::Matrix glyph_matrix;
         _getGlyphTransformMatrix(glyph_index, &glyph_matrix);
-        NR::Matrix total_transform = glyph_matrix;
+        Geom::Matrix total_transform = glyph_matrix;
         total_transform *= transform;
         if(_glyphs[glyph_index].span(this).font) {
-           boost::optional<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
+           boost::optional<Geom::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
             if (glyph_rect) {
-               NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max();
-               NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]);
+               Geom::Point bmi = glyph_rect->min(), bma = glyph_rect->max();
+               Geom::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]);
                 tlp *= total_transform;
                 trp *= total_transform;
                 blp *= total_transform;
                 brp *= total_transform;
-                *glyph_rect = NR::Rect(tlp,trp);
+                *glyph_rect = Geom::Rect(tlp,trp);
                 glyph_rect->expandTo(blp);
                 glyph_rect->expandTo(brp);
                 if ( (glyph_rect->min())[0] < bounding_box->x0 ) bounding_box->x0=(glyph_rect->min())[0];
@@ -139,7 +139,7 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i
 
 void Layout::print(SPPrintContext *ctx,
                    NRRect const *pbox, NRRect const *dbox, NRRect const *bbox,
-                   NR::Matrix const &ctm) const
+                   Geom::Matrix const &ctm) const
 {
     if (_input_stream.empty()) return;
 
@@ -154,7 +154,7 @@ void Layout::print(SPPrintContext *ctx,
                 glyph_index++;
             continue;
         }
-        NR::Matrix glyph_matrix;
+        Geom::Matrix glyph_matrix;
         Span const &span = _spans[_characters[_glyphs[glyph_index].in_character].in_span];
         InputStreamTextSource const *text_source = static_cast<InputStreamTextSource const *>(_input_stream[span.in_input_stream_item]);
         if (text_to_path || _path_fitted) {
@@ -169,8 +169,8 @@ void Layout::print(SPPrintContext *ctx,
             }
             glyph_index++;
         } else {
-            NR::Point g_pos(0,0);    // all strings are output at (0,0) because we do the translation using the matrix
-            glyph_matrix = NR::Matrix(NR::scale(1.0, -1.0) * NR::Matrix(NR::rotate(_glyphs[glyph_index].rotation)));
+            Geom::Point g_pos(0,0);    // all strings are output at (0,0) because we do the translation using the matrix
+            glyph_matrix = Geom::Scale(1.0, -1.0) * (Geom::Matrix)Geom::Rotate(_glyphs[glyph_index].rotation);
             if (block_progression == LEFT_TO_RIGHT || block_progression == RIGHT_TO_LEFT) {
                 glyph_matrix[4] = span.line(this).baseline_y + span.baseline_shift;
                 // since we're outputting character codes, not glyphs, we want the character x
@@ -230,7 +230,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
         Span const &span = _spans[_characters[_glyphs[glyph_index].in_character].in_span];
         InputStreamTextSource const *text_source = static_cast<InputStreamTextSource const *>(_input_stream[span.in_input_stream_item]);
 
-        NR::Matrix glyph_matrix;
+        Geom::Matrix glyph_matrix;
         _getGlyphTransformMatrix(glyph_index, &glyph_matrix);
         if (clip_mode) {
             Geom::PathVector const *pathv = span.font->PathVector(_glyphs[glyph_index].glyph);
@@ -243,13 +243,13 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
             continue;
         }
 
-        NR::Matrix font_matrix;
+        Geom::Matrix font_matrix;
         if (_path_fitted == NULL) {
             font_matrix = glyph_matrix;
             font_matrix[4] = 0;
             font_matrix[5] = 0;
         } else {
-            font_matrix.set_identity();
+            font_matrix.setIdentity();
         }
 
         Glib::ustring::const_iterator span_iter = span.input_stream_first_character;
@@ -300,14 +300,14 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
         
         if (_path_fitted) {
             ctx->pushState();
-            ctx->transform(&to_2geom(glyph_matrix));
+            ctx->transform(&glyph_matrix);
         } else if (opacity != 1.0) {
             ctx->pushState();
             ctx->setStateForStyle(style);
             ctx->pushLayer();
         }
         if (glyph_index - first_index > 0)
-            ctx->renderGlyphtext(span.font->pFont, &to_2geom(font_matrix), glyphtext, style);
+            ctx->renderGlyphtext(span.font->pFont, &font_matrix, glyphtext, style);
         if (_path_fitted)
             ctx->popState();
         else if (opacity != 1.0) {
@@ -440,7 +440,7 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
             NR::Point tangent;
             const_cast<Path&>(path).PointAndTangentAt(point_otp[0].piece, point_otp[0].t, point, tangent);
             _empty_cursor_shape.position = point;
-            _empty_cursor_shape.rotation = atan2(tangent[NR::Y], tangent[NR::X]);
+            _empty_cursor_shape.rotation = atan2(tangent[Geom::Y], tangent[Geom::X]);
         }
     }
 
@@ -478,7 +478,6 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
         if (midpoint_offset >= 0.0 && midpoint_otp != NULL && midpoint_otp[0].piece >= 0) {
             NR::Point midpoint;
             NR::Point tangent;
-
             const_cast<Path&>(path).PointAndTangentAt(midpoint_otp[0].piece, midpoint_otp[0].t, midpoint, tangent);
 
             if (start_offset >= 0.0 && end_offset >= 0.0) {
@@ -504,7 +503,7 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
                                 tangent = endpoint - startpoint;
                                 tangent.normalize();
                             } else {
-                                tangent = NR::Point (0,0);
+                                tangent = Geom::Point (0,0);
                             }
                         }
                         g_free(end_otp);
@@ -544,7 +543,7 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
     GSList *cc = NULL;
 
     for (int glyph_index = from_glyph._glyph_index ; glyph_index < to_glyph._glyph_index ; glyph_index++) {
-        NR::Matrix glyph_matrix;
+        Geom::Matrix glyph_matrix;
         Span const &span = _glyphs[glyph_index].span(this);
         _getGlyphTransformMatrix(glyph_index, &glyph_matrix);
 
@@ -573,12 +572,12 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
     return curve;
 }
 
-void Layout::transform(NR::Matrix const &transform)
+void Layout::transform(Geom::Matrix const &transform)
 {
     // this is all massively oversimplified
     // I can't actually think of anybody who'll want to use it at the moment, so it'll stay simple
     for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; glyph_index++) {
-        NR::Point point(_glyphs[glyph_index].x, _glyphs[glyph_index].y);
+        Geom::Point point(_glyphs[glyph_index].x, _glyphs[glyph_index].y);
         point *= transform;
         _glyphs[glyph_index].x = point[0];
         _glyphs[glyph_index].y = point[1];
index bff94c151fad6b8445e6246233e21c2dced8e407..1bfde1f2d1708a8678768aa7c05a02cc728a2b47 100644 (file)
@@ -85,9 +85,9 @@ Layout::ShapeScanlineMaker::ShapeScanlineMaker(Shape const *shape, Layout::Direc
         _shape_needs_freeing = true;
         temp_rotated_shape->Copy(const_cast<Shape*>(shape));
         switch (block_progression) {
-            case BOTTOM_TO_TOP: temp_rotated_shape->Transform(NR::Matrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0)); break;  // reflect about x axis
-            case LEFT_TO_RIGHT: temp_rotated_shape->Transform(NR::Matrix(0.0, 1.0, 1.0, 0.0, 0.0, 0.0)); break;   // reflect about y=x
-            case RIGHT_TO_LEFT: temp_rotated_shape->Transform(NR::Matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)); break;  // reflect about y=-x
+            case BOTTOM_TO_TOP: temp_rotated_shape->Transform(Geom::Matrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0)); break;  // reflect about x axis
+            case LEFT_TO_RIGHT: temp_rotated_shape->Transform(Geom::Matrix(0.0, 1.0, 1.0, 0.0, 0.0, 0.0)); break;   // reflect about y=x
+            case RIGHT_TO_LEFT: temp_rotated_shape->Transform(Geom::Matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)); break;  // reflect about y=-x
             default: break;
         }
         _rotated_shape = new Shape;
index cea97ff2a9b05549dc2595c398ab8f99ca586264..3d0c5728838bbb6761dbb487327e07e3c61dd415 100644 (file)
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
-#include "libnr/nr-rect.h"
-#include "libnr/nr-matrix.h"
-#include "libnr/nr-matrix-ops.h"
-#include "libnr/nr-rotate-ops.h"
+#include <libnr/nr-matrix-ops.h>
+#include <libnr/nr-rotate-ops.h>
+#include <libnr/nr-rect.h>
+#include <2geom/d2.h>
+#include <2geom/matrix.h>
 #include <glibmm/ustring.h>
 #include <pango/pango-break.h>
 #include <algorithm>
@@ -332,7 +333,7 @@ public:
       \param transform     The transform to be applied to the entire object
                            prior to calculating its bounds.
     */
-    void getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, int start = -1, int length = -1) const;
+    void getBoundingBox(NRRect *bounding_box, Geom::Matrix const &transform, int start = -1, int length = -1) const;
 
     /** Sends all the glyphs to the given print context.
      \param ctx   I have
@@ -341,7 +342,7 @@ public:
      \param bbox  parameters
      \param ctm   do yet
     */
-    void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, NR::Matrix const &ctm) const;
+    void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, Geom::Matrix const &ctm) const;
 
 #ifdef HAVE_CAIRO_PDF    
     /** Renders all the glyphs to the given Cairo rendering context.
@@ -375,7 +376,7 @@ public:
     /** Apply the given transform to all the output presently stored in
     this object. This only transforms the glyph positions, The glyphs
     themselves will not be transformed. */
-    void transform(NR::Matrix const &transform);
+    void transform(Geom::Matrix const &transform);
 
     //@}
 
@@ -418,13 +419,13 @@ public:
     /** Returns an iterator pointing to the cursor position for a mouse
     click at the given coordinates. */
     iterator getNearestCursorPositionTo(double x, double y) const;
-    inline iterator getNearestCursorPositionTo(NR::Point &point) const;
+    inline iterator getNearestCursorPositionTo(Geom::Point const &point) const;
 
     /** Returns an iterator pointing to the letter whose bounding box contains
     the given coordinates. end() if the point is not over any letter. The
     iterator will \em not point at the specific glyph within the character. */
     iterator getLetterAt(double x, double y) const;
-    inline iterator getLetterAt(NR::Point &point) const;
+    inline iterator getLetterAt(Geom::Point &point) const;
 
     /** Returns an iterator pointing to the character in the output which
     was created from the given input. If the character at the given byte
@@ -448,7 +449,7 @@ public:
     /** Returns the bounding box of the given glyph, and its rotation.
     The centre of rotation is the horizontal centre of the box at the
     text baseline. */
-    boost::optional<NR::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
+    boost::optional<Geom::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
 
     /** Returns the zero-based line number of the character pointed to by
     \a it. */
@@ -477,22 +478,22 @@ public:
     void getSourceOfCharacter(iterator const &it, void **source_cookie, Glib::ustring::iterator *text_iterator = NULL) const;
 
     /** For latin text, the left side of the character, on the baseline */
-    NR::Point characterAnchorPoint(iterator const &it) const;
+    Geom::Point characterAnchorPoint(iterator const &it) const;
 
     /** This is that value to apply to the x,y attributes of tspan role=line
     elements, and hence it takes alignment into account. */
-    NR::Point chunkAnchorPoint(iterator const &it) const;
+    Geom::Point chunkAnchorPoint(iterator const &it) const;
 
     /** Returns the box extents (not ink extents) of the given character.
     The centre of rotation is at the horizontal centre of the box on the
     text baseline. */
-    NR::Rect characterBoundingBox(iterator const &it, double *rotation = NULL) const;
+    Geom::Rect characterBoundingBox(iterator const &it, double *rotation = NULL) const;
 
     /** Basically uses characterBoundingBox() on all the characters from
     \a start to \a end and returns the union of these boxes. The return value
     is a list of zero or more quadrilaterals specified by a group of four
     points for each, thus size() is always a multiple of four. */
-    std::vector<NR::Point> createSelectionShape(iterator const &it_start, iterator const &it_end, NR::Matrix const &transform) const;
+    std::vector<Geom::Point> createSelectionShape(iterator const &it_start, iterator const &it_end, Geom::Matrix const &transform) const;
 
     /** Returns true if \a it points to a character which is a valid cursor
     position, as defined by Pango. */
@@ -507,7 +508,7 @@ public:
       \param rotation  The angle to draw from \a position. Radians, zero up,
                        increasing clockwise.
     */
-    void queryCursorShape(iterator const &it, NR::Point *position, double *height, double *rotation) const;
+    void queryCursorShape(iterator const &it, Geom::Point &position, double &height, double &rotation) const;
 
     /** Returns true if \a it points to a character which is a the start of
     a word, as defined by Pango. */
@@ -652,7 +653,7 @@ private:
     void _calculateCursorShapeForEmpty();
 
     struct CursorShape {
-        NR::Point position;
+        Geom::Point position;
         double height;
         double rotation;
     } _empty_cursor_shape;
@@ -737,7 +738,7 @@ private:
 
     /** gets the overall matrix that transforms the given glyph from local
     space to world space. */
-    void _getGlyphTransformMatrix(int glyph_index, NR::Matrix *matrix) const;
+    void _getGlyphTransformMatrix(int glyph_index, Geom::Matrix *matrix) const;
 
     // loads of functions to drill down the object tree, all of them
     // annoyingly similar and all of them requiring predicate functors.
@@ -954,10 +955,10 @@ inline void Layout::validateIterator(Layout::iterator *it) const
         it->_glyph_index = _characters[it->_char_index].in_glyph;
 }
 
-inline Layout::iterator Layout::getNearestCursorPositionTo(NR::Point &point) const
+inline Layout::iterator Layout::getNearestCursorPositionTo(Geom::Point const &point) const
     {return getNearestCursorPositionTo(point[0], point[1]);}
 
-inline Layout::iterator Layout::getLetterAt(NR::Point &point) const
+inline Layout::iterator Layout::getLetterAt(Geom::Point &point) const
     {return getLetterAt(point[0], point[1]);}
 
 inline unsigned Layout::lineIndex(iterator const &it) const
index 10e65366470a61aec66727aae904da6ec9df7f3e..3fbbe62d7cf8050430acb9f6cbc4e07065fcf3b8 100644 (file)
@@ -26,7 +26,7 @@ void          font_style::Apply(Path* src,Shape* dest) {
        if ( stroke_width > 0 ) {
                if ( nbDash > 0 ) {
                        double dlen = 0.0;
-                       const float scale = 1/*NR::expansion(transform)*/;
+                       const float scale = 1/*Geom::expansion(transform)*/;
                        for (int i = 0; i < nbDash; i++)  dlen += dashes[i] * scale;
                        if (dlen >= 0.01) {
                                float   sc_offset = dash_offset * scale;
@@ -96,26 +96,26 @@ raster_glyph*  raster_font::GetGlyph(int glyph_id)
   }
   return res;
 }
-NR::Point      raster_font::Advance(int glyph_id)
+Geom::Point      raster_font::Advance(int glyph_id)
 {
-       if ( daddy == NULL ) return NR::Point(0,0);
+       if ( daddy == NULL ) return Geom::Point(0,0);
        double    a=daddy->Advance(glyph_id,style.vertical);
-       NR::Point f_a=(style.vertical)?NR::Point(0,a):NR::Point(a,0);
+       Geom::Point f_a=(style.vertical)?Geom::Point(0,a):Geom::Point(a,0);
        return f_a*style.transform;
 }
 void           raster_font::BBox(int glyph_id,NRRect *area)
 {
        area->x0=area->y0=area->x1=area->y1=0;
        if ( daddy == NULL ) return;
-       boost::optional<NR::Rect> res=daddy->BBox(glyph_id);
+       boost::optional<Geom::Rect> res=daddy->BBox(glyph_id);
        if (res) {
-               NR::Point bmi=res->min(),bma=res->max();
-               NR::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]);
+               Geom::Point bmi=res->min(),bma=res->max();
+               Geom::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]);
                tlp=tlp*style.transform;
                trp=trp*style.transform;
                blp=blp*style.transform;
                brp=brp*style.transform;
-               *res=NR::Rect(tlp,trp);
+               *res=Geom::Rect(tlp,trp);
                res->expandTo(blp);
                res->expandTo(brp);
                area->x0=(res->min())[0];
@@ -356,7 +356,7 @@ void      raster_glyph::LoadSubPixelPosition(int no)
   delete theI;
 }
 
-void      raster_glyph::Blit(const NR::Point &at,NRPixBlock &over)
+void      raster_glyph::Blit(const Geom::Point &at,NRPixBlock &over)
 {
   if ( nb_sub_pixel <= 0 ) return;
   int pv=(int)ceil(at[1]);
index 268b7c58fddedbd08f184078551d1e59fe183f18..015121b421df838dac2cfd9232dcc3961d49c833 100644 (file)
@@ -36,7 +36,7 @@ public:
     void                          Ref(void);
 
                // utility functions
-    NR::Point      Advance(int glyph_id);
+    Geom::Point      Advance(int glyph_id);
     void           BBox(int glyph_id,NRRect *area);         
 
                // attempts to load a glyph and return a raster_glyph on which you can call Blit
index f2e3438f1b2084c07bc43465c34873ceb7bff9b2..2c8340e8a3096beff03441352e247a3cd47ddc50 100644 (file)
@@ -13,6 +13,7 @@
 #include <libnrtype/font-style.h>
 #include <livarot/livarot-forward.h>
 #include "libnr/nr-rect.h"
+#include <2geom/d2.h>
 
 // the font_instance are the template of several raster_font; they provide metrics and outlines
 // that are drawn by the raster_font, so the raster_font needs info relative to the way the 
@@ -77,10 +78,10 @@ public:
     bool                 FontMetrics(double &ascent, double &descent, double &leading);
     bool                 FontSlope(double &run, double &rise);
                                 // for generating slanted cursors for oblique fonts
-    boost::optional<NR::Rect>             BBox(int glyph_id);
+    boost::optional<Geom::Rect>             BBox(int glyph_id);
 
                // creates a rasterfont for the given style
-    raster_font*         RasterFont(NR::Matrix const &trs, double stroke_width,
+    raster_font*         RasterFont(Geom::Matrix const &trs, double stroke_width,
                                     bool vertical = false, JoinType stroke_join = join_straight,
                                     ButtType stroke_cap = butt_straight, float miter_limit = 4.0);
                // the dashes array in iStyle is copied
index 748d2020aa7791af6e83055e80cbdfbb239826b8..20f03df86004efd481e27d770097226e08ee75d0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SEEN_LIBNRTYPE_FONT_STYLE_H
 #define SEEN_LIBNRTYPE_FONT_STYLE_H
 
-#include <libnr/nr-matrix.h>
+#include <2geom/matrix.h>
 #include <livarot/LivarotDefs.h>
 #include <livarot/livarot-forward.h>
 
@@ -9,7 +9,7 @@
 
 // Different raster styles.
 struct font_style {
-    NR::Matrix    transform; // the ctm. contains the font-size
+    Geom::Matrix  transform; // the ctm. contains the font-size
     bool          vertical;  // should be rendered vertically or not? 
                                // good font support would take the glyph alternates for vertical mode, when present
     double        stroke_width; // if 0, the glyph is filled; otherwise stroked
index d8a85a4a11938cfdb227b29a0194638c591e1827..82a0b3f8e3fb3eef7af3a98da9c51a7b98e47040 100644 (file)
@@ -31,7 +31,7 @@ public:
 
                // the interesting function: blits the glyph onto over
                // over should be a mask, ie a NRPixBlock with one 8bit plane
-    void      Blit(NR::Point const &at, NRPixBlock &over); // alpha only
+    void      Blit(Geom::Point const &at, NRPixBlock &over); // alpha only
 };
 
 
index 5345485e2fb682a86d0bced868765de0618649da..2b3ae46fcede878a13c268b1e840ae84607719db 100644 (file)
@@ -3712,7 +3712,7 @@ node_request(SPKnot */*knot*/, NR::Point *p, guint state, gpointer data)
         }
     }
 
-    n->subpath->nodepath->desktop->scroll_to_point(p);
+    n->subpath->nodepath->desktop->scroll_to_point(*p);
 
     return TRUE;
 }
index bfe73a43db4b4ea286b2a72f288bfe09c53ca895..97a260f0fc46a93a7c488c1f7b6c35b39221243c 100644 (file)
@@ -79,7 +79,7 @@ void Inkscape::Rubberband::move(NR::Point const &p)
         return;
 
     _end = p;
-    _desktop->scroll_to_point(&p);
+    _desktop->scroll_to_point(p);
     _touchpath_curve->lineto(p);
 
     NR::Point next = _desktop->d2w(p);
index 2ce9a8b50222a029b7df74cac301215e4ebc8c16..d8d624e9410e65a844302d8cf97804e54dae0e78 100644 (file)
@@ -126,7 +126,7 @@ void Inkscape::SelCue::_updateItemBboxes()
         if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline
             Inkscape::Text::Layout const *layout = te_get_layout(item);
             if (layout != NULL) {
-                NR::Point a = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(item));
+                Geom::Point a = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
                 baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL,
                                                     "mode", SP_CTRL_MODE_XOR,
                                                     "size", 4.0,
index 7c966c9b9114f44adbf2a123da7d8c3de4761b80..acbeb2c1822aeff525f134099d8100a562b650d6 100644 (file)
@@ -530,7 +530,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                         }
                         if (!seltrans->isEmpty())
                             seltrans->moveTo(p, event->button.state);
-                        desktop->scroll_to_point(&p);
+                        desktop->scroll_to_point(p);
                         gobble_motion_events(GDK_BUTTON1_MASK);
                         ret = TRUE;
                     } else {
index f47d4b0b741fc040b6f4dd4ef5d4fa542c59c50e..3e0da0571e92f24f9edb3d97058a8da659906d1c 100644 (file)
@@ -50,6 +50,8 @@
 #include "libnr/nr-matrix-translate-ops.h"
 #include "libnr/nr-rotate-fns.h"
 #include "libnr/nr-scale-ops.h"
+#include <libnr/nr-matrix-ops.h>
+#include <libnr/nr-rotate-ops.h>
 #include "libnr/nr-scale-translate-ops.h"
 #include "libnr/nr-translate-matrix-ops.h"
 #include "libnr/nr-translate-scale-ops.h"
@@ -152,7 +154,7 @@ GSList *sp_selection_paste_impl (SPDocument *doc, SPObject *parent, GSList **cli
         NR::Matrix local (sp_item_i2doc_affine(SP_ITEM(parent)));
         if (!local.test_identity()) {
             gchar const *t_str = copy->attribute("transform");
-            NR::Matrix item_t (NR::identity());
+            Geom::Matrix item_t (NR::identity());
             if (t_str)
                 sp_svg_transform_read(t_str, &item_t);
             item_t *= local.inverse();
@@ -489,7 +491,7 @@ void sp_selection_group(SPDesktop *desktop)
                 // At this point, current may already have no item, due to its being a clone whose original is already moved away
                 // So we copy it artificially calculating the transform from its repr->attr("transform") and the parent transform
                 gchar const *t_str = current->attribute("transform");
-                NR::Matrix item_t (NR::identity());
+                Geom::Matrix item_t (NR::identity());
                 if (t_str)
                     sp_svg_transform_read(t_str, &item_t);
                 item_t *= sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent())));
index 32c20ace698a6fd1f751b71207563ed266b5f5d7..d59e7f0bc372ba1f813529c0fbe8c8b4f05160d0 100644 (file)
@@ -565,7 +565,7 @@ void ShapeEditor::select_next () {
     if (this->nodepath) {
         sp_nodepath_select_next (this->nodepath);
         if (this->nodepath->numSelected() >= 1) {
-            this->desktop->scroll_to_point(&(this->nodepath->singleSelectedCoords()), 1.0);
+            this->desktop->scroll_to_point(this->nodepath->singleSelectedCoords(), 1.0);
         }
     }
 }
@@ -573,7 +573,7 @@ void ShapeEditor::select_prev () {
     if (this->nodepath) {
         sp_nodepath_select_prev (this->nodepath);
         if (this->nodepath->numSelected() >= 1) {
-            this->desktop->scroll_to_point(&(this->nodepath->singleSelectedCoords()), 1.0);
+            this->desktop->scroll_to_point(this->nodepath->singleSelectedCoords(), 1.0);
         }
     }
 }
index 59ced44e56e836bd8f33b64068feb15ad2dd3ed3..fcfb84968a8b59a0d611919679f8322b3ec04432 100644 (file)
@@ -432,7 +432,7 @@ static void sp_text_snappoints(SPItem const *item, SnapPointsIter p)
     // the baseline anchor of the first char
     Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
     if(layout != NULL) {
-        *p = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(item));
+        *p = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
     }
 }
 
index 4c3329fb72e73e8fdaf74dd150f6d9679382231b..2a804dfbdd2cde68d74e061e399a20ca36676ab9 100644 (file)
@@ -1568,29 +1568,29 @@ sp_text_context_update_cursor(SPTextContext *tc,  bool scroll_to_see)
     if (!tc->desktop) return;
 
     if (tc->text) {
-        NR::Point p0, p1;
+        Geom::Point p0, p1;
         sp_te_get_cursor_coords(tc->text, tc->text_sel_end, p0, p1);
-        NR::Point const d0 = p0 * from_2geom(sp_item_i2d_affine(SP_ITEM(tc->text)));
-        NR::Point const d1 = p1 * from_2geom(sp_item_i2d_affine(SP_ITEM(tc->text)));
+        Geom::Point const d0 = p0 * sp_item_i2d_affine(SP_ITEM(tc->text));
+        Geom::Point const d1 = p1 * sp_item_i2d_affine(SP_ITEM(tc->text));
 
         // scroll to show cursor
         if (scroll_to_see) {
-            NR::Point const center = SP_EVENT_CONTEXT(tc)->desktop->get_display_area().midpoint();
+            Geom::Point const center = SP_EVENT_CONTEXT(tc)->desktop->get_display_area().midpoint();
             if (NR::L2(d0 - center) > NR::L2(d1 - center))
                 // unlike mouse moves, here we must scroll all the way at first shot, so we override the autoscrollspeed
-                SP_EVENT_CONTEXT(tc)->desktop->scroll_to_point(&d0, 1.0);
+                SP_EVENT_CONTEXT(tc)->desktop->scroll_to_point(d0, 1.0);
             else
-                SP_EVENT_CONTEXT(tc)->desktop->scroll_to_point(&d1, 1.0);
+                SP_EVENT_CONTEXT(tc)->desktop->scroll_to_point(d1, 1.0);
         }
 
         sp_canvas_item_show(tc->cursor);
         sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), d0, d1);
 
         /* fixme: ... need another transformation to get canvas widget coordinate space? */
-        im_cursor.x = (int) floor(d0[NR::X]);
-        im_cursor.y = (int) floor(d0[NR::Y]);
-        im_cursor.width = (int) floor(d1[NR::X]) - im_cursor.x;
-        im_cursor.height = (int) floor(d1[NR::Y]) - im_cursor.y;
+        im_cursor.x = (int) floor(d0[Geom::X]);
+        im_cursor.y = (int) floor(d0[Geom::Y]);
+        im_cursor.width = (int) floor(d1[Geom::X]) - im_cursor.x;
+        im_cursor.height = (int) floor(d1[Geom::Y]) - im_cursor.y;
 
         tc->show = TRUE;
         tc->phase = 1;
@@ -1636,7 +1636,7 @@ static void sp_text_context_update_text_selection(SPTextContext *tc)
     }
     tc->text_selection_quads.clear();
 
-    std::vector<NR::Point> quads;
+    std::vector<Geom::Point> quads;
     if (tc->text != NULL)
         quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, sp_item_i2d_affine(tc->text));
     for (unsigned i = 0 ; i < quads.size() ; i += 4) {
index be098b7e9ede655f0999ee55b5c2a2842cec9922..48266cfceca68de38d8208c0d1c2b4b94eb2348c 100644 (file)
@@ -78,34 +78,34 @@ sp_te_input_is_empty (SPObject const *item)
 }
 
 Inkscape::Text::Layout::iterator
-sp_te_get_position_by_coords (SPItem const *item, NR::Point &i_p)
+sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p)
 {
-    NR::Matrix im (sp_item_i2d_affine (item));
+    Geom::Matrix im (sp_item_i2d_affine (item));
     im = im.inverse();
 
-    NR::Point p = i_p * im;
+    Geom::Point p = i_p * im;
     Inkscape::Text::Layout const *layout = te_get_layout(item);
     return layout->getNearestCursorPositionTo(p);
 }
 
-std::vector<NR::Point> sp_te_create_selection_quads(SPItem const *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, NR::Matrix const &transform)
+std::vector<Geom::Point> sp_te_create_selection_quads(SPItem const *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, Geom::Matrix const &transform)
 {
     if (start == end)
-        return std::vector<NR::Point>();
+        return std::vector<Geom::Point>();
     Inkscape::Text::Layout const *layout = te_get_layout(item);
     if (layout == NULL)
-        return std::vector<NR::Point>();
+        return std::vector<Geom::Point>();
 
     return layout->createSelectionShape(start, end, transform);
 }
 
 void
-sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator const &position, NR::Point &p0, NR::Point &p1)
+sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator const &position, Geom::Point &p0, Geom::Point &p1)
 {
     Inkscape::Text::Layout const *layout = te_get_layout(item);
     double height, rotation;
-    layout->queryCursorShape(position, &p0, &height, &rotation);
-    p1 = NR::Point(p0[NR::X] + height * sin(rotation), p0[NR::Y] - height * cos(rotation));
+    layout->queryCursorShape(position, p0, height, rotation);
+    p1 = Geom::Point(p0[NR::X] + height * sin(rotation), p0[NR::Y] - height * cos(rotation));
 }
 
 SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position)
index 2f3e5363c8fd8fe6459cb168a4ab022cc50151e3..bdb6664eed0f40557c2b009587b06a3f43f2a811 100644 (file)
@@ -32,10 +32,10 @@ bool sp_te_input_is_empty (SPObject const *item);
 
 unsigned sp_text_get_length(SPObject const *item);
 unsigned sp_text_get_length_upto(SPObject const *item, SPObject const *upto);
-std::vector<NR::Point> sp_te_create_selection_quads(SPItem const *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, NR::Matrix const &transform);
+std::vector<Geom::Point> sp_te_create_selection_quads(SPItem const *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, Geom::Matrix const &transform);
 
-Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, NR::Point &i_p);
-void sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator const &position, NR::Point &p0, NR::Point &p1);
+Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p);
+void sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator const &position, Geom::Point &p0, Geom::Point &p1);
 double sp_te_get_average_linespacing (SPItem *text);
 
 
index e83907f492cb5b2e8ccb91ab132ba2382cb7b380..0e93ecb12350267f7a4fd2c72ede8f657e2ff320 100644 (file)
@@ -694,7 +694,7 @@ private :
         {
             if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
                 Inkscape::Text::Layout const *layout = te_get_layout(*it);
-                Geom::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
+                Geom::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it);
                 if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X];
                 if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y];
                 if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X];
@@ -735,7 +735,7 @@ private :
             {
                 if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
                     Inkscape::Text::Layout const *layout = te_get_layout(*it);
-                    Geom::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
+                    Geom::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it);
                     Geom::Point t(0.0, 0.0);
                     t[_orientation] = b_min[_orientation] - base[_orientation];
                     sp_item_move_rel(*it, NR::translate(t));
index 5c6aa35e736c982bab00ca4dac62950d17d81cc8..577efe7c15b1aee1631be7382c2611129cf052a5 100644 (file)
@@ -671,7 +671,7 @@ static gint sp_font_preview_expose(GtkWidget *widget, GdkEventExpose *event)
                         hpos[len] = base_pt[0];
                         len++;
                         if ( curF ) {
-                            boost::optional<NR::Rect> nbbox = curF->BBox(str_text->glyph_text[i].gl);
+                            boost::optional<Geom::Rect> nbbox = curF->BBox(str_text->glyph_text[i].gl);
                             if (nbbox) {
                                 bbox.x0 = MIN(bbox.x0, base_pt[Geom::X] + theSize * (nbbox->min())[0]);
                                 bbox.y0 = MIN(bbox.y0, base_pt[Geom::Y] - theSize * (nbbox->max())[1]);