Code

optional start index and length in getBoundingBox, for tspan bboxes
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 5 Feb 2006 00:46:03 +0000 (00:46 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 5 Feb 2006 00:46:03 +0000 (00:46 +0000)
src/libnrtype/Layout-TNG-Output.cpp
src/libnrtype/Layout-TNG.h

index 08eb403db972d1908948f07a65d1e8ff06aa80ae..b6249248bc90775c4ec7ce154870a77f15f94e77 100755 (executable)
@@ -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);
index 6400ee77b8a29c99c3791efff6f9f29d3fc35a77..5c86d3135ac6cd06a4e6d548d8743cb5d8a5b663 100755 (executable)
@@ -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