TextStyle improvements

This commit is contained in:
Emux 2016-12-12 11:35:04 +02:00
parent 1de6ca8fb7
commit 1a93e4ae13

View File

@ -186,8 +186,8 @@ public final class TextStyle extends RenderStyle<TextStyle> {
this.bitmap = text.bitmap; this.bitmap = text.bitmap;
this.texture = text.texture; this.texture = text.texture;
this.fillColor = text.paint.getColor(); this.fillColor = text.paint.getColor();
this.fontFamily = FontFamily.DEFAULT; this.fontFamily = text.fontFamily;
this.fontStyle = FontStyle.NORMAL; this.fontStyle = text.fontStyle;
if (text.stroke != null) { if (text.stroke != null) {
this.strokeColor = text.stroke.getColor(); this.strokeColor = text.stroke.getColor();
this.strokeWidth = text.stroke.getStrokeWidth(); this.strokeWidth = text.stroke.getStrokeWidth();
@ -230,6 +230,8 @@ public final class TextStyle extends RenderStyle<TextStyle> {
} else } else
stroke = null; stroke = null;
this.fontFamily = tb.fontFamily;
this.fontStyle = tb.fontStyle;
this.fontSize = tb.fontSize; this.fontSize = tb.fontSize;
this.symbolWidth = tb.symbolWidth; this.symbolWidth = tb.symbolWidth;
@ -239,7 +241,9 @@ public final class TextStyle extends RenderStyle<TextStyle> {
public final String style; public final String style;
public final float fontSize; public final FontFamily fontFamily;
public final FontStyle fontStyle;
public float fontSize;
public final Paint paint; public final Paint paint;
public final Paint stroke; public final Paint stroke;
public final String textKey; public final String textKey;
@ -282,9 +286,10 @@ public final class TextStyle extends RenderStyle<TextStyle> {
@Override @Override
public void scaleTextSize(float scaleFactor) { public void scaleTextSize(float scaleFactor) {
paint.setTextSize(fontSize * scaleFactor); fontSize *= scaleFactor;
paint.setTextSize(fontSize);
if (stroke != null) if (stroke != null)
stroke.setTextSize(fontSize * scaleFactor); stroke.setTextSize(fontSize);
fontHeight = paint.getFontHeight(); fontHeight = paint.getFontHeight();
fontDescent = paint.getFontDescent(); fontDescent = paint.getFontDescent();