From a8b3d8494f30a63efc57b12082f4be45b5d4c101 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sun, 5 Feb 2006 00:46:03 +0000 Subject: [PATCH] optional start index and length in getBoundingBox, for tspan bboxes --- src/libnrtype/Layout-TNG-Output.cpp | 8 +++++++- src/libnrtype/Layout-TNG.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 08eb403db..b6249248b 100755 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -83,10 +83,16 @@ 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) const +void Layout::getBoundingBox(NRRect *bounding_box, NR::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; + if (start != -1 && _glyphs[glyph_index].in_character < start) continue; + if (length != -1) { + if (start == -1) + start = 0; + if (_glyphs[glyph_index].in_character > start + length) continue; + } // this could be faster NRMatrix glyph_matrix; _getGlyphTransformMatrix(glyph_index, &glyph_matrix); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index 6400ee77b..5c86d3135 100755 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -314,7 +314,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) const; + void getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, int start = -1, int length = -1) const; /** Sends all the glyphs to the given print context. \param ctx I have -- 2.30.2