Skip to content

Commit fc22e91

Browse files
committed
fix: use explicit SP units for icon font sizing
- MappingListItem: 10sp with COMPLEX_UNIT_SP - CommandPaletteDialog preview: 14sp with COMPLEX_UNIT_SP Using explicit TypedValue.COMPLEX_UNIT_SP ensures consistent sizing across different screen densities. — opus 4.5
1 parent 7864072 commit fc22e91

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/main/kotlin/tribixbite/cleverkeys/ShortSwipeCustomizationActivity.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,7 @@ private fun MappingListItem(
547547
// Use AndroidView with special font for icon characters when useKeyFont is true
548548
if (mapping.useKeyFont) {
549549
// Show icon using special font via AndroidView
550-
// Keyboard uses sublabelTextSize=0.22 vs labelTextSize=0.33 (ratio ~0.67)
551-
// Icon font glyphs are visually larger, so use ~8sp to match 13sp text visually
550+
// Use smaller size (10sp) to approximate keyboard sublabel appearance
552551
Row(verticalAlignment = Alignment.CenterVertically) {
553552
Text(
554553
text = "\"",
@@ -559,7 +558,7 @@ private fun MappingListItem(
559558
factory = { ctx ->
560559
android.widget.TextView(ctx).apply {
561560
typeface = Theme.getKeyFont(ctx)
562-
textSize = 8f // Match keyboard sublabel ratio (0.22/0.33 of main text)
561+
setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 10f)
563562
setTextColor(android.graphics.Color.WHITE)
564563
text = mapping.displayText
565564
}

src/main/kotlin/tribixbite/cleverkeys/customization/CommandPaletteDialog.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,12 @@ private fun LabelConfirmationDialog(
326326
}
327327
isIconMode -> {
328328
// Icon mode with default label - render with special font
329-
// Keyboard uses sublabelTextSize=0.22 vs labelTextSize=0.33 (ratio ~0.67)
330-
// 18sp text * 0.67 ≈ 12sp for icon to match keyboard proportions
329+
// Use 14sp to be visible in preview while smaller than 18sp text
331330
AndroidView(
332331
factory = { ctx ->
333332
android.widget.TextView(ctx).apply {
334333
typeface = Theme.getKeyFont(ctx)
335-
textSize = 12f
334+
setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 14f)
336335
setTextColor(android.graphics.Color.WHITE)
337336
text = defaultLabel
338337
}

0 commit comments

Comments
 (0)