diff options
| author | Jasper van de Gronde <jasper.vandegronde@gmail.com> | 2008-03-21 19:53:10 +0000 |
|---|---|---|
| committer | jaspervdg <jaspervdg@users.sourceforge.net> | 2008-03-21 19:53:10 +0000 |
| commit | 40a243a7a5e67d4f09a82bfbee5babe40ec924b7 (patch) | |
| tree | 5f43830b59a1c448f880a39cd2d23b8cc1058d97 /src/libnrtype | |
| parent | Start working toward multiple inheritance (diff) | |
| download | inkscape-40a243a7a5e67d4f09a82bfbee5babe40ec924b7.tar.gz inkscape-40a243a7a5e67d4f09a82bfbee5babe40ec924b7.zip | |
No more NRMatrix or NRPoint.
(bzr r5149)
Diffstat (limited to 'src/libnrtype')
| -rwxr-xr-x | src/libnrtype/Layout-TNG-Output.cpp | 33 | ||||
| -rwxr-xr-x | src/libnrtype/Layout-TNG.h | 4 | ||||
| -rw-r--r-- | src/libnrtype/RasterFont.cpp | 2 |
3 files changed, 20 insertions, 19 deletions
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index d689fbe30..9ff953c47 100755 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -15,6 +15,7 @@ #include "print.h" #include "extension/print.h" #include "livarot/Path.h" +#include "libnr/nr-matrix-fns.h" #include "libnr/nr-scale-matrix-ops.h" #include "font-instance.h" #include "svg/svg-length.h" @@ -55,7 +56,7 @@ void Layout::LineHeight::max(LineHeight const &other) if (other.leading > leading) leading = other.leading; } -void Layout::_getGlyphTransformMatrix(int glyph_index, NRMatrix *matrix) const +void Layout::_getGlyphTransformMatrix(int glyph_index, NR::Matrix *matrix) const { Span const &span = _glyphs[glyph_index].span(this); double sin_rotation = sin(_glyphs[glyph_index].rotation); @@ -86,7 +87,7 @@ 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) { - NRMatrix glyph_matrix; + NR::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); } @@ -108,7 +109,7 @@ 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 - NRMatrix glyph_matrix; + NR::Matrix glyph_matrix; _getGlyphTransformMatrix(glyph_index, &glyph_matrix); NR::Matrix total_transform = glyph_matrix; total_transform *= transform; @@ -133,7 +134,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, - NRMatrix const &ctm) const + NR::Matrix const &ctm) const { if (_input_stream.empty()) return; @@ -147,7 +148,7 @@ void Layout::print(SPPrintContext *ctx, glyph_index++; continue; } - NRMatrix glyph_matrix; + NR::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) { @@ -168,12 +169,12 @@ void Layout::print(SPPrintContext *ctx, 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))); if (block_progression == LEFT_TO_RIGHT || block_progression == RIGHT_TO_LEFT) { - glyph_matrix.c[4] = span.line(this).baseline_y + span.baseline_shift; + glyph_matrix[4] = span.line(this).baseline_y + span.baseline_shift; // since we're outputting character codes, not glyphs, we want the character x - glyph_matrix.c[5] = span.chunk(this).left_x + span.x_start + _characters[_glyphs[glyph_index].in_character].x; + glyph_matrix[5] = span.chunk(this).left_x + span.x_start + _characters[_glyphs[glyph_index].in_character].x; } else { - glyph_matrix.c[4] = span.chunk(this).left_x + span.x_start + _characters[_glyphs[glyph_index].in_character].x; - glyph_matrix.c[5] = span.line(this).baseline_y + span.baseline_shift; + glyph_matrix[4] = span.chunk(this).left_x + span.x_start + _characters[_glyphs[glyph_index].in_character].x; + glyph_matrix[5] = span.line(this).baseline_y + span.baseline_shift; } Glib::ustring::const_iterator span_iter = span.input_stream_first_character; unsigned char_index = _glyphs[glyph_index].in_character; @@ -226,7 +227,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]); - NRMatrix glyph_matrix; + NR::Matrix glyph_matrix; _getGlyphTransformMatrix(glyph_index, &glyph_matrix); if (clip_mode) { NArtBpath *bpath = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph); @@ -242,13 +243,13 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const continue; } - NRMatrix font_matrix; + NR::Matrix font_matrix; if (_path_fitted == NULL) { font_matrix = glyph_matrix; font_matrix[4] = 0; font_matrix[5] = 0; } else { - nr_matrix_set_identity(&font_matrix); + font_matrix.set_identity(); } Glib::ustring::const_iterator span_iter = span.input_stream_first_character; @@ -276,8 +277,8 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const CairoGlyphInfo info; info.index = _glyphs[glyph_index].glyph; if (_path_fitted == NULL) { - info.x = glyph_matrix.c[4]; - info.y = glyph_matrix.c[5]; + info.x = glyph_matrix[4]; + info.y = glyph_matrix[5]; } else { info.x = 0; info.y = 0; @@ -288,7 +289,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const } } while (glyph_index < _glyphs.size() && _path_fitted == NULL - && nr_matrix_test_transform_equal(&font_matrix, &glyph_matrix, NR_EPSILON) + && NR::transform_equalp(font_matrix, glyph_matrix, NR_EPSILON) && _characters[_glyphs[glyph_index].in_character].in_span == this_span_index); // remove vertical flip @@ -543,7 +544,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++) { - NRMatrix glyph_matrix; + NR::Matrix glyph_matrix; Span const &span = _glyphs[glyph_index].span(this); _getGlyphTransformMatrix(glyph_index, &glyph_matrix); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index 63a48e562..ec12ddff5 100755 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -337,7 +337,7 @@ public: \param bbox parameters \param ctm do yet */ - void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, NRMatrix const &ctm) const; + void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, NR::Matrix const &ctm) const; #ifdef HAVE_CAIRO_PDF /** Renders all the glyphs to the given Cairo rendering context. @@ -733,7 +733,7 @@ private: /** gets the overall matrix that transforms the given glyph from local space to world space. */ - void _getGlyphTransformMatrix(int glyph_index, NRMatrix *matrix) const; + void _getGlyphTransformMatrix(int glyph_index, NR::Matrix *matrix) const; // loads of functions to drill down the object tree, all of them // annoyingly similar and all of them requiring predicate functors. diff --git a/src/libnrtype/RasterFont.cpp b/src/libnrtype/RasterFont.cpp index c9af6621f..61ef1720b 100644 --- a/src/libnrtype/RasterFont.cpp +++ b/src/libnrtype/RasterFont.cpp @@ -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_MATRIX_DF_EXPANSION (&transform)*/; + const float scale = 1/*NR::expansion(transform)*/; for (int i = 0; i < nbDash; i++) dlen += dashes[i] * scale; if (dlen >= 0.01) { float sc_offset = dash_offset * scale; |
