Moved the outline inset to getBounds (where float rectangle is used) and enlarged the inset

(Because e.g. "k" in "Droid Sans Mono" has very sharp corners, which were outside the active text shadow)
This commit is contained in:
Olga Miller 2017-03-11 21:07:24 +01:00
parent 68701fc5a1
commit c3917bb40d

View file

@ -95,6 +95,10 @@ class LabelPainter {
public RectF getBounds() { public RectF getBounds() {
RectF bounds = new RectF(getTextBounds()); RectF bounds = new RectF(getTextBounds());
bounds.offset(mX, mY); bounds.offset(mX, mY);
if (mLabel.getOutline()) {
float inset = mLabel.getOutlineSize() * mPaint.getTextSize();
bounds.inset(-inset, -inset);
}
return bounds; return bounds;
} }
@ -113,10 +117,6 @@ class LabelPainter {
Rect bounds = new Rect(); Rect bounds = new Rect();
String text = mLabel.getText(); String text = mLabel.getText();
mPaint.getTextBounds(text, 0, text.length(), bounds); mPaint.getTextBounds(text, 0, text.length(), bounds);
if (mLabel.getOutline()) {
int dxOutline = (int) (mLabel.getOutlineSize() * mPaint.getTextSize()) / 2;
bounds.inset(-dxOutline, -dxOutline);
}
return bounds; return bounds;
} }