diff options
| author | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-05-03 10:10:54 +0000 |
|---|---|---|
| committer | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-05-03 10:10:54 +0000 |
| commit | 87de3cf4c4bdda888744604424ad58c1aba6c192 (patch) | |
| tree | 3a8fa25059381d0ef56b1555229188f503a32f0b | |
| parent | Refer to correct array index in chunkAnchorPoint (diff) | |
| download | inkscape-87de3cf4c4bdda888744604424ad58c1aba6c192.tar.gz inkscape-87de3cf4c4bdda888744604424ad58c1aba6c192.zip | |
Adds out of bound check for selecting text on path
Fixes https://gitlab.com/inkscape/inbox/issues/420
| -rw-r--r-- | src/libnrtype/Layout-TNG-OutIter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp index ca52018af..7d7ee98f0 100644 --- a/src/libnrtype/Layout-TNG-OutIter.cpp +++ b/src/libnrtype/Layout-TNG-OutIter.cpp @@ -308,8 +308,10 @@ Geom::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) co if (_path_fitted) { double cluster_half_width = 0.0; - for (int glyph_index = _characters[char_index].in_glyph ; _glyphs[glyph_index].in_character == char_index ; glyph_index++) + for (int glyph_index = _characters[char_index].in_glyph ; _glyphs.size() != glyph_index ; glyph_index++) { + if (_glyphs[glyph_index].in_character != char_index) break; cluster_half_width += _glyphs[glyph_index].width; + } cluster_half_width *= 0.5; double midpoint_offset = _characters[char_index].span(this).x_start + _characters[char_index].x + cluster_half_width; |
