diff options
author | Stefan Wildemann <gta04@metalstrolche.de> | 2019-07-21 12:50:18 +0200 |
---|---|---|
committer | Stefan Wildemann <gta04@metalstrolche.de> | 2019-07-21 12:51:52 +0200 |
commit | 61287a836fa02cce4d8dd442673e81541e0c5f4a (patch) | |
tree | 46f2ff9ac9369dd9582a09bbddb8240b50b92ef0 | |
parent | 0264b9ff817cb11cae1103866d6429ee222e783e (diff) | |
parent | 92fea7eb4db7873ecac9e6963d32e554cad10218 (diff) | |
download | navit-61287a836fa02cce4d8dd442673e81541e0c5f4a.tar.gz |
Fix coordinate transformation for text bbox.
Of course a bbox does have 4 coordinates, not just one. Now displaying
of text looks as expected. We can revert the text hack from qt5.
-rw-r--r-- | navit/graphics.c | 5 | ||||
-rw-r--r-- | navit/graphics/qt5/graphics_qt5.cpp | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/navit/graphics.c b/navit/graphics.c index 4b0c173b2..8216dc719 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -1131,7 +1131,10 @@ void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret, int estimate) { this_->meth.get_text_bbox(this_->priv, font->priv, text, dx, dy, ret, estimate); - *ret=graphics_dpi_unscale_point(this_,ret); + ret[0]=graphics_dpi_unscale_point(this_,&(ret[0])); + ret[1]=graphics_dpi_unscale_point(this_,&(ret[1])); + ret[2]=graphics_dpi_unscale_point(this_,&(ret[2])); + ret[3]=graphics_dpi_unscale_point(this_,&(ret[3])); } /** diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index b34ad7250..80b7b601f 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -536,11 +536,11 @@ static void draw_text(struct graphics_priv* gr, struct graphics_gc_priv* fg, str shadow.setColor(bg->pen->color()); shadow.setWidth(3); painter->setPen(shadow); - path.addText(0, (font->font->pixelSize()/2) * -1, *font->font, tmp); + path.addText(0, 0, *font->font, tmp); painter->drawPath(path); } painter->setPen(*fg->pen); - painter->drawText(0, (font->font->pixelSize()/2) *-1, tmp); + painter->drawText(0, 0, tmp); painter->setWorldMatrix(sav); #endif } |