Fix bullet list item size (depend on text size and not top-bottom arguments)

This commit is contained in:
Dimitry Ivanov 2018-05-25 12:14:18 +03:00
parent ddb8989669
commit 3a0b08eb07

View File

@ -48,12 +48,15 @@ public class BulletListItemSpan implements LeadingMarginSpan {
try { try {
final int width = theme.getBlockMargin(); final int width = theme.getBlockMargin();
final int height = bottom - top;
final int side = theme.getBulletWidth(bottom - top); // @since 1.0.6 we no longer rely on (bottom-top) calculation in order to detect line height
// it lead to bad rendering as first & last lines received different results even
// if text size is the same (first line received greater amount and bottom line -> less)
final int textLineHeight = (int) (paint.descent() - paint.ascent() + .5F);
final int side = theme.getBulletWidth(textLineHeight);
final int marginLeft = (width - side) / 2; final int marginLeft = (width - side) / 2;
final int marginTop = (height - side) / 2;
// in order to support RTL // in order to support RTL
final int l; final int l;
@ -64,7 +67,8 @@ public class BulletListItemSpan implements LeadingMarginSpan {
l = Math.min(left, right); l = Math.min(left, right);
r = Math.max(left, right); r = Math.max(left, right);
} }
final int t = top + marginTop;
final int t = baseline + (int) ((paint.descent() + paint.ascent()) / 2.F + .5F) - (side / 2);
final int b = t + side; final int b = t + side;
if (level == 0 if (level == 0