@@ -329,11 +329,15 @@ class FormatTextView : AppCompatTextView {
329329 }
330330 var userDefaultDelete = true
331331 if (deleteLine && (formatText.deleteLineColor != 0 || formatText.deleteLineWidth != 0f )) {
332+ val textPaint = TextPaint ()
333+ textPaint.textSize = if (textSize> 0 ) sp2px(textSize.toFloat()) else getTextSize()
334+ val fm = textPaint.fontMetrics
335+
332336 val deleteLineText = LineText (
333337 start,
334338 end,
335339 if (formatText.deleteLineColor != 0 ) resources.getColor(formatText.deleteLineColor) else textColor,
336- 0f ,
340+ fm.ascent + (fm.top - fm.ascent) ,
337341 if (formatText.deleteLineWidth == 0f ) dp2px(1f ) else dp2px(formatText.deleteLineWidth)
338342 )
339343 deleteLineTexts.add(deleteLineText)
@@ -461,7 +465,7 @@ class FormatTextView : AppCompatTextView {
461465 for (i in deleteLineText.start until deleteLineText.end) {
462466 val bound = getDeleteLineBound(i)
463467 pts[ptsIndex + 0 ] = bound.left.toFloat()
464- pts[ptsIndex + 1 ] = ( bound.bottom + bound.top). toFloat()
468+ pts[ptsIndex + 1 ] = bound.bottom. toFloat() + deleteLineText.lineTop / 4
465469 pts[ptsIndex + 2 ] = bound.right.toFloat()
466470 pts[ptsIndex + 3 ] = pts[ptsIndex + 1 ]
467471 ptsIndex + = 4
@@ -477,10 +481,8 @@ class FormatTextView : AppCompatTextView {
477481 val layout = layout
478482 val bound = Rect ()
479483 val line = layout.getLineForOffset(index)
480- layout.getLineBounds(line,bound)
481- val lineAscent = layout.getLineAscent(line)
482- bound.top = layout.getLineTop(line)
483- bound.bottom = - lineAscent* 3 / 4
484+ val baseline = layout.getLineBaseline(line)
485+ bound.bottom = baseline
484486 bound.left = layout.getPrimaryHorizontal(index).toInt()
485487 bound.right = layout.getPrimaryHorizontal(index + 1 ).toInt()
486488 if (bound.right < bound.left) {
0 commit comments