From a72c4fff26bcdfd3cc07a0510a82f38f4e0658ee Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Fri, 12 Apr 2013 22:44:13 +0200 Subject: [PATCH] fix Text.create() --- src/org/oscim/theme/renderinstruction/Text.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/oscim/theme/renderinstruction/Text.java b/src/org/oscim/theme/renderinstruction/Text.java index a3bcb671..9790d262 100644 --- a/src/org/oscim/theme/renderinstruction/Text.java +++ b/src/org/oscim/theme/renderinstruction/Text.java @@ -120,8 +120,12 @@ public final class Text extends RenderInstruction { public static Text createText(float fontSize, float strokeWidth, int fill, int outline, boolean billboard) { - return new Text("", "", FontFamily.DEFAULT, FontStyle.NORMAL, + Text t = new Text("", "", FontFamily.DEFAULT, FontStyle.NORMAL, fontSize, fill, outline, strokeWidth, 0, billboard, Integer.MAX_VALUE); + FontMetrics fm = t.paint.getFontMetrics(); + t.fontHeight = (float) Math.ceil(Math.abs(fm.bottom) + Math.abs(fm.top)); + t.fontDescent = (float) Math.ceil(Math.abs(fm.bottom)); + return t; } private static int getStyle(FontStyle fontStyle) {