Skip to content

Commit e84a7ae

Browse files
committed
fix: the last candidate font size is abnormal
1 parent ee4f035 commit e84a7ae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/com/osfans/trime/ime/composition/Composition.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
142142
private val highlightTextColor: Int?,
143143
private val highlightBackColor: Int?,
144144
private val textColor: Int?,
145+
private val textSize: Int,
145146
) : ClickableSpan() {
146147
override fun onClick(tv: View) {
147148
textInputManager?.onCandidatePressed(index)
148149
}
149150

150151
override fun updateDrawState(ds: TextPaint) {
152+
ds.textSize = sp(textSize).toFloat()
151153
ds.isUnderlineText = false
152154
ds.typeface = typeface
153155
if (index == highlightIndex) {
@@ -319,6 +321,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
319321
highlightLabelColor,
320322
highlightCandidateBackColor,
321323
labelColor,
324+
labelTextSize,
322325
)
323326
inSpans(alignmentSpan, labelSpan, labelTextSizeSpan) { append(label) }
324327

@@ -329,6 +332,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
329332
highlightCandidateTextColor,
330333
highlightCandidateBackColor,
331334
candidateTextColor,
335+
candidateTextSize,
332336
)
333337
inSpans(alignmentSpan, candidateSpan, candidateTextSizeSpan) { append(text) }
334338
currentLineLength += text.length
@@ -341,6 +345,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
341345
highlightCommentTextColor,
342346
highlightCandidateBackColor,
343347
commentTextColor,
348+
commentTextSize,
344349
)
345350
inSpans(alignmentSpan, commentSpan, commentTextSizeSpan) { append(comment) }
346351
currentLineLength += comment.length

0 commit comments

Comments
 (0)