summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-02-05 00:46:03 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-02-05 00:46:03 +0000
commitce8f1c16d6fb305c9ebe2b00ab0b5e2c561fa405 (patch)
tree146c8cd5562aeb28f5f0c3ce5204f54b55db4a34 /src/libnrtype
parentsp_text_get_length_upto to count length recursively up to a given child (diff)
downloadinkscape-ce8f1c16d6fb305c9ebe2b00ab0b5e2c561fa405.tar.gz
inkscape-ce8f1c16d6fb305c9ebe2b00ab0b5e2c561fa405.zip
optional start index and length in getBoundingBox, for tspan bboxes
(bzr r77)
Diffstat (limited to 'src/libnrtype')
-rwxr-xr-xsrc/libnrtype/Layout-TNG-Output.cpp8
-rwxr-xr-xsrc/libnrtype/Layout-TNG.h2
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