summaryrefslogtreecommitdiffstats
path: root/src/display/drawing-text.cpp
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-10-30 09:37:37 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-10-30 09:37:37 +0000
commit4f5842a050121a1d6ef71c3840b7c0815f485df0 (patch)
treeed017e564c494ca0fbc5c05c460b3253a86bce04 /src/display/drawing-text.cpp
parentCMake/MSYS2: minor dependency update for lxml (diff)
downloadinkscape-4f5842a050121a1d6ef71c3840b7c0815f485df0.tar.gz
inkscape-4f5842a050121a1d6ef71c3840b7c0815f485df0.zip
Improve picking selecton on text
Diffstat (limited to 'src/display/drawing-text.cpp')
-rw-r--r--src/display/drawing-text.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index 46d05d399..4eb4224d5 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -123,13 +123,21 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext
Geom::OptRect pb;
if (_drawable) {
- Geom::PathVector *glyphv = _font->PathVector(42); //we fix to "X" char to allow always a reasonable bbox
- if (glyphv && !glyphv->empty()) {
- pb = bounds_exact_transformed(*glyphv, ctx.ctm);
- pb->expandBy(pb->height()/10.0); //we scale a bit the area to in between char gaps mainly
+ Geom::PathVector *glyphv = _font->PathVector(_glyph);
+ if (glyphv && !glyphv->empty()) {
+ pb = bounds_exact_transformed(*glyphv, ctx.ctm);
+ }
+ glyphv = _font->PathVector(42);
+ if (glyphv && !glyphv->empty()) {
+ if (pb) {
+ pb.unionWith(bounds_exact_transformed(*glyphv, ctx.ctm));
+ } else {
+ pb = bounds_exact_transformed(*glyphv, ctx.ctm);
+ }
+ pb.expandTo(Geom::Point((*pb).right() + (_width * ctx.ctm.descrim()), (*pb).bottom()));
}
}
- if(!pb){ // Fallback, spaces mostly, this never happendd with fixed gliph
+ if (!pb) { // Fallback
Geom::Rect pbigbox(Geom::Point(0.0, _asc*scale_bigbox*0.66),Geom::Point(_width*scale_bigbox, 0.0));
pb = pbigbox * ctx.ctm;
}