diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 45584721eb..493414efbe 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -705,6 +705,8 @@ public class OsmandSettings { MAP_ZOOM_SCALE_BY_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 0.5f); } + public final CommonPreference TEXT_SCALE = new FloatPreference("text_scale", 1f).makeGlobal().cache(); + public float getSettingsZoomScale(float density){ // by default scale between [0, 1[ density (because of lots map complains) return MAP_ZOOM_SCALE_BY_DENSITY.get() + (float)Math.sqrt(Math.max(0, density - 1)); diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 37a3422365..f29e6ed184 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -676,8 +676,12 @@ public class MapRenderRepositories { currentRenderingContext.nightMode = nightMode; currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get(); currentRenderingContext.setDensityValue(mapDensity); - currentRenderingContext.textScale = 1.0f; //Text/icon scales according to mapDensity -// currentRenderingContext.textScale = 1 / mapDensity; //Text/icon stays same for all sizes + //Text/icon scales according to mapDensity (so text is size of road) +// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get()); + //Text/icon stays same for all sizes + currentRenderingContext.textScale = (requestedBox.getDensity() * app.getSettings().TEXT_SCALE.get()) + / mapDensity; + currentRenderingContext.screenDensityRatio = 1 / Math.max(1, requestedBox.getDensity()) ; // init rendering context currentRenderingContext.tileDivisor = tileDivisor; diff --git a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java index 6d2373aef0..b2c4770526 100644 --- a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java @@ -250,15 +250,14 @@ public class TextRenderer { cv.drawTextOnPath(text.text, text.drawOnPath, 0, text.vOffset, paintText); } else { if (text.shieldRes != null) { + float coef = rc.getDensityValue(rc.screenDensityRatio * rc.textScale); Bitmap ico = RenderingIcons.getIcon(context, text.shieldRes); if (ico != null) { - float left = text.centerX - ico.getWidth() / 2 * rc.screenDensityRatio - - 0.5f; - float top = text.centerY - ico.getHeight() / 2 * rc.screenDensityRatio - - rc.getDensityValue(4.5f); + float left = text.centerX - ico.getWidth() / 2 * coef - 0.5f; + float top = text.centerY - ico.getHeight() / 2 * coef - rc.getDensityValue(4.5f); if(rc.screenDensityRatio != 1f){ - RectF rf = new RectF(left, top, left + ico.getWidth() * rc.screenDensityRatio , - top + ico.getHeight() * rc.screenDensityRatio); + RectF rf = new RectF(left, top, left + ico.getWidth() * coef, + top + ico.getHeight() * coef); Rect src = new Rect(0, 0, ico.getWidth(), ico .getHeight()); cv.drawBitmap(ico, src, rf, paintIcon);