Skip to content

Commit

Permalink
Merge pull request nickbutcher#104 from eneim/eneim/fix-line-spacing-add
Browse files Browse the repository at this point in the history
Eneim/fix line spacing add
  • Loading branch information
nickbutcher authored Jul 19, 2016
2 parents 8ae979a + 3f16925 commit 35cac9d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ private void recalculate(int width) {
int fontHeight = Math.abs(fm.ascent - fm.descent) + fm.leading;
final int baselineAlignedLineHeight =
(int) (fourDip * (float) Math.ceil(lineHeightHint / fourDip));
final int lineSpacingAdd = baselineAlignedLineHeight - fontHeight;
// Addition line spacing to match desired line height. Should be non-negative.
final int lineSpacingAdd = Math.max(0, baselineAlignedLineHeight - fontHeight);

// now create the layout with our desired insets & line height
createLayout(width, lineSpacingAdd);
Expand Down

0 comments on commit 35cac9d

Please sign in to comment.