diff --git a/Dockerfile.build b/Dockerfile.build index f18f608612..5b27b8404d 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -54,6 +54,7 @@ RUN apt-get update --error-on=any && \ wget \ fuse3 \ file \ + fontconfig \ appstream \ gpg \ zipalign \ diff --git a/apps/multiplatform/build.gradle.kts b/apps/multiplatform/build.gradle.kts index ee64060206..9688e3a268 100644 --- a/apps/multiplatform/build.gradle.kts +++ b/apps/multiplatform/build.gradle.kts @@ -107,6 +107,14 @@ configure(subprojects) { if (jvmVersion.isPresent) jvmTarget = jvmVersion.get() } } + + configurations.configureEach { + resolutionStrategy.eachDependency { + if (requested.group == "org.jetbrains.skiko" && requested.version == "0.9.4.2") { + useVersion("0.9.24") + } + } + } } tasks.register("clean", Delete::class) { diff --git a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/BubbleLayoutTest.kt b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/BubbleLayoutTest.kt index 2ce3febff7..46c52526b0 100644 --- a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/BubbleLayoutTest.kt +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/BubbleLayoutTest.kt @@ -33,6 +33,18 @@ import kotlin.math.roundToInt import kotlin.test.Test import kotlin.test.assertEquals +private val TIME_BELOW_TEXT_PX = mapOf( + 0.7f to listOf(0, 0, 0), + 0.8f to listOf(1, 0, 0), + 0.9f to listOf(-1, 0, 0), + 1f to listOf(0, 0, -1), + 1.1f to listOf(0, 0, 0), + 1.2f to listOf(1, 1, 0), + 1.3f to listOf(0, 0, 0), + 1.4f to listOf(-1, 0, 0), + 1.5f to listOf(0, 0, 0), +) + class BubbleLayoutTest { private val density = Density(1f) private val inset = with(density) { BUBBLE_TEXT_INSET.roundToPx() } @@ -138,14 +150,14 @@ class BubbleLayoutTest { } @Test - fun timeDrawnOnTextBaseline() { + fun timeOffsetFromTextBaseline() { val texts = listOf<@Composable () -> TextStyle>( { TextStyle(fontFamily = Inter, fontSize = 16.sp).merge(bubbleTextStyle(16.sp, HighOrLowlight)) }, { TextStyle(fontFamily = Inter, fontSize = 13.sp, lineHeight = 18.sp, lineHeightStyle = LineHeightStyle(LineHeightStyle.Alignment.Center, LineHeightStyle.Trim.None)).merge(bubbleLineHeight(18.sp)) }, { TextStyle(fontFamily = Inter, fontSize = 16.sp).merge(bubbleLineHeight(16.sp * INTER_LINE_HEIGHT)) }, ) - for (fontScale in listOf(0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f)) { - texts.forEachIndexed { i, textStyle -> + val timeBelowText = TIME_BELOW_TEXT_PX.keys.associateWith { fontScale -> + texts.map { textStyle -> val image = renderScene { CompositionLocalProvider(LocalBubbleLayout provides true, LocalDensity provides Density(1f, fontScale)) { Row(Modifier.background(Color.White)) { @@ -159,9 +171,10 @@ class BubbleLayoutTest { } } } - assertEquals(lastInkRow(image, placed.getValue("text")), lastInkRow(image, placed.getValue("time")), "text $i at font scale $fontScale") + lastInkRow(image, placed.getValue("time")) - lastInkRow(image, placed.getValue("text")) } } + assertEquals(TIME_BELOW_TEXT_PX, timeBelowText) } private fun lastInkRow(image: Image, area: Placed): Int { diff --git a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/FallbackFontTest.kt b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/FallbackFontTest.kt new file mode 100644 index 0000000000..6fe0fbbee8 --- /dev/null +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/FallbackFontTest.kt @@ -0,0 +1,87 @@ +package chat.simplex.app + +import org.jetbrains.skia.FontMgr +import org.jetbrains.skia.paragraph.FontCollection +import org.jetbrains.skia.paragraph.ParagraphBuilder +import org.jetbrains.skia.paragraph.ParagraphStyle +import org.jetbrains.skia.paragraph.TextStyle +import org.junit.Assume.assumeNoException +import org.junit.Assume.assumeTrue +import java.io.IOException +import java.nio.file.Files +import java.nio.file.Path +import java.util.concurrent.TimeUnit +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +private const val LAYOUT_WAIT_SECONDS = 60L + +private const val SNOWMAN_BDF = """STARTFONT 2.1 +FONT -misc-snowman-medium-r-normal--8-80-75-75-c-80-iso10646-1 +SIZE 8 75 75 +FONTBOUNDINGBOX 8 8 0 0 +STARTPROPERTIES 5 +FAMILY_NAME "Snowman" +FONT_ASCENT 8 +FONT_DESCENT 0 +CHARSET_REGISTRY "ISO10646" +CHARSET_ENCODING "1" +ENDPROPERTIES +CHARS 1 +STARTCHAR snowman +ENCODING 9731 +SWIDTH 1000 0 +DWIDTH 8 0 +BBX 8 8 0 0 +BITMAP +3C +42 +3C +42 +81 +81 +42 +3C +ENDCHAR +ENDFONT +""" + +class FallbackFontTest { + @Test + fun textIsLaidOutWhenTheOnlyFallbackFontIsBitmap() = withTempDir { dir -> + assumeTrue("fontconfig selects fallback fonts only on Linux", System.getProperty("os.name") == "Linux") + Files.createDirectory(dir.resolve("fonts")) + Files.writeString(dir.resolve("fonts/snowman.bdf"), SNOWMAN_BDF) + Files.writeString(dir.resolve("fonts.conf"), "$dir/fonts$dir/cache") + val fcCache = try { + startWithFonts(dir, "fc-cache").waitFor() + } catch (e: IOException) { + assumeNoException("fc-cache is not installed", e) + return@withTempDir + } + assumeTrue("fc-cache indexes the font, as it does for installed fonts", fcCache == 0) + val java = Path.of(System.getProperty("java.home"), "bin", "java").toString() + val layout = startWithFonts(dir, java, "-cp", System.getProperty("java.class.path"), LayOutSnowman::class.java.name) + val finished = layout.waitFor(LAYOUT_WAIT_SECONDS, TimeUnit.SECONDS) + if (!finished) layout.destroyForcibly() + assertTrue(finished, "layout must end within $LAYOUT_WAIT_SECONDS s") + assertEquals(0, layout.exitValue(), Files.readString(dir.resolve("output.log"))) + } + + private fun startWithFonts(dir: Path, vararg command: String): Process = + ProcessBuilder(*command) + .directory(dir.toFile()) + .redirectErrorStream(true) + .redirectOutput(dir.resolve("output.log").toFile()) + .apply { environment()["FONTCONFIG_FILE"] = dir.resolve("fonts.conf").toString() } + .start() +} + +object LayOutSnowman { + @JvmStatic + fun main(args: Array) { + val fonts = FontCollection().setDefaultFontManager(FontMgr.default) + ParagraphBuilder(ParagraphStyle(), fonts).pushStyle(TextStyle()).addText("☃").build().layout(100f) + } +} diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-dark-font-100.png index 640a28de88..9e1e059494 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-light-font-100.png index 170b8e11a8..0a75f34763 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/AdvancedNetworkSettings.PreviewAdvancedNetworkSettingsLayout-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-dark-font-100.png index 0cccd47882..9f0918f20c 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-light-font-100.png index 782526edef..acee637fff 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.ChannelMembers-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-dark-font-100.png index 5797220b1e..3b262f9a7b 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-light-font-100.png index 3f983eeaba..855fb404d2 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.LinksAndBadge-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-dark-font-100.png index 10c8e27d87..7cdfe819fe 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-light-font-100.png index f48af72dcf..76c4bc40e8 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Lists-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-dark-font-100.png index 5226a17673..bd05ce1604 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-light-font-100.png index 6cd1632db2..bec0d5cfbb 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/Avatars.Rows-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-100.png index 55b6e928f1..19edf5d656 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-140.png index 322ace5214..83ad9260f7 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-150.png index 9b17a7bf7b..6183feca57 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-dark-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-100.png index 3a21146054..8bd97969a6 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-140.png index d97ac2e0a9..2f1363e657 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-150.png index 19448a4865..effc9febb8 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewAcceptedPreview-light-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-100.png index 98cfac9216..8207de4f47 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-140.png index a8e184b564..35544988f5 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-150.png index 31b4ed222b..2b027ff5eb 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-dark-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-100.png index 97280f9eae..cc36255dc8 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-140.png index ece28fe4f4..1b5f956260 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-150.png index 07b013065c..2a60b4ab19 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.CIGroupInvitationViewLongNamePreview-light-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-100.png index bb8e0d4f8f..40293d1136 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-140.png index 9fb09d068a..b840ea5dc7 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-150.png index 1020e11edf..b2f2fbe4bf 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-dark-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-100.png index 435c97dab7..ae1a9f96b1 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-140.png index a64fb7459d..e87949718f 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-150.png b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-150.png index 53ac5462db..8d349bd3c4 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-150.png and b/apps/multiplatform/common/src/desktopTest/snapshots/CIGroupInvitationView.PendingCIGroupInvitationViewPreview-light-font-150.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-dark-font-100.png index 129bda0cf3..4274b13b3c 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-light-font-100.png index dd1e84e4d7..634db4fae8 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatHelpView.PreviewChatHelpLayout-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewDeletedContent-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewDeletedContent-light-font-140.png index 9fe901eb6f..fe2c30f84a 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewDeletedContent-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewDeletedContent-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewEmptyLinesTerminal-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewEmptyLinesTerminal-dark-font-140.png index c7d94f2d21..5576247ddf 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewEmptyLinesTerminal-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatItemView.PreviewChatItemViewEmptyLinesTerminal-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminal-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminal-dark-font-140.png index 44c7654057..0dd50bfbfd 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminal-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminal-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalDefects-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalDefects-dark-font-140.png index bb1e2398e1..2dca985233 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalDefects-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalDefects-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-dark-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-dark-font-140.png index 2c1367c02c..93a678c18c 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-dark-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-dark-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-light-font-140.png index 49e87ea4ee..4e4e461faa 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ChatView.PreviewGroupChatLayoutTerminalMedia-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-dark-font-100.png index 1010afd3e8..74d86f3907 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-light-font-100.png index a33e3e4d7f..bc56c81aec 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/ContactConnectionInfoView.PreviewContactConnectionInfoView-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-dark-font-100.png index 9ef4fc95c3..8f3d11d2c5 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-light-font-100.png index 6d7bb7e0df..91f623b083 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/DatabaseView.PreviewDatabaseLayout-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/DeletedItemView.PreviewDeletedItemView-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/DeletedItemView.PreviewDeletedItemView-light-font-140.png index 9fe901eb6f..fe2c30f84a 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/DeletedItemView.PreviewDeletedItemView-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/DeletedItemView.PreviewDeletedItemView-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-dark-font-100.png index dcbece6adf..5e6c5220bc 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-light-font-100.png index 8cdbb18516..f01f90e282 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/HelpView.PreviewHelpView-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/IntegrityErrorItemView.IntegrityErrorItemViewPreview-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/IntegrityErrorItemView.IntegrityErrorItemViewPreview-light-font-140.png index 8011430f76..aec1e9ef5e 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/IntegrityErrorItemView.IntegrityErrorItemViewPreview-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/IntegrityErrorItemView.IntegrityErrorItemViewPreview-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/MarkedDeletedItemView.PreviewMarkedDeletedItemView-light-font-140.png b/apps/multiplatform/common/src/desktopTest/snapshots/MarkedDeletedItemView.PreviewMarkedDeletedItemView-light-font-140.png index 5c28f00714..43dad75978 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/MarkedDeletedItemView.PreviewMarkedDeletedItemView-light-font-140.png and b/apps/multiplatform/common/src/desktopTest/snapshots/MarkedDeletedItemView.PreviewMarkedDeletedItemView-light-font-140.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-dark-font-100.png index 061529ebe4..703eb6f140 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-light-font-100.png index bd48d856f0..588909d91f 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/NetworkAndServers.PreviewNetworkAndServersLayout-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-dark-font-100.png index c503ffc6b6..1119398902 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-light-font-100.png index 18e8704055..756c9f42ec 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SetNotificationsMode.PreviewSetNotificationsMode-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-dark-font-100.png index 92d0d71805..569808b38b 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-light-font-100.png index 6f2dd35320..861218f6d7 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SettingsView.PreviewSettingsLayout-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-dark-font-100.png index 5f8892e866..2ca1ff22e9 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-light-font-100.png index c881f5a126..79aee6e5e6 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/SimpleXInfo.PreviewSimpleXInfo-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-dark-font-100.png index e918b87318..22189164dc 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-light-font-100.png index 2c4fb48774..3c142ce965 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutAddressCreated-light-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-dark-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-dark-font-100.png index 866b63bea7..1ec99c3ca4 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-dark-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-dark-font-100.png differ diff --git a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-light-font-100.png b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-light-font-100.png index fb363f3c4a..6dc12e07c0 100644 Binary files a/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-light-font-100.png and b/apps/multiplatform/common/src/desktopTest/snapshots/UserAddressView.PreviewUserAddressLayoutNoAddress-light-font-100.png differ diff --git a/apps/multiplatform/spec/client/chat-view.md b/apps/multiplatform/spec/client/chat-view.md index 2f74d41332..e83ec25aa1 100644 --- a/apps/multiplatform/spec/client/chat-view.md +++ b/apps/multiplatform/spec/client/chat-view.md @@ -215,7 +215,7 @@ In chats with avatars the item is in the message column, after the avatar column When `LocalBubbleLayout.current` is true (classic chats, provided by `ChatView` with `LocalTerminalLayout`, the classic theme preview, and the chat item and chat view previews through [`BubblePreview`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt#L1506-L1509)), bubbles follow one inset (plans/2026-10-25-classic-bubbles.md). The previews of deleted and error items clip them as `ChatItemView` does (`clipChatItem`). - Texts use `chatTextStyle`, as terminal rows: message text, captions, Markdown blocks, quote text and sender (`body1`, Inter), headers, the time, event texts; the texts of `DeletedItemView` and error items through [`bubbleTextStyle(fontSize, color)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/TerminalItemView.kt#L91-L93), `chatTextStyle` in bubbles only, so the cards of terminal rows keep their style (the one-line text of `MarkedDeletedItemView` keeps its style, its line height rounded by `bubbleLineHeight`). Call items are drawn as in master: `ChatItemView` provides `LocalBubbleLayout` false for them. Markdown blocks in bubbles have the heading gaps, heading sizes and `headingBox` of terminal rows; cards and rules have `TERMINAL_BLOCK_TOP_GAP` (5.75sp) above and `TERMINAL_BLOCK_BOTTOM_GAP` (5sp) below, and each empty line typed is one line of the text style. -- On desktop, [`bubbleLineHeight(lineHeight)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/TerminalItemView.kt#L95-L101) rounds a line height in bubbles to whole pixels, with the proportional alignment of `chatTextStyle`: `chatTextStyle` applies it in bubbles, and so do the last text of a group invitation (18sp, or "Tap to join" at the line height of Inter, `INTER_LINE_HEIGHT`), "Fix connection" of decryption errors and the size line of files (the line height of Inter) and the text of `MarkedDeletedItemView` (22sp); on Android the line heights are unchanged. Skia draws the baseline of a line at its top plus the rounded ascent and reports the rounded line height less the descent, which Compose rounds into `FirstBaseline` and `LastBaseline`; both are one pixel row only when ascent and descent add up to whole pixels, so the time, placed by reported baselines, is drawn on the baseline of the text (owner report). +- On desktop, [`bubbleLineHeight(lineHeight)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/TerminalItemView.kt#L95-L101) rounds a line height in bubbles to whole pixels, with the proportional alignment of `chatTextStyle`: `chatTextStyle` applies it in bubbles, and so do the last text of a group invitation (18sp, or "Tap to join" at the line height of Inter, `INTER_LINE_HEIGHT`), "Fix connection" of decryption errors and the size line of files (the line height of Inter) and the text of `MarkedDeletedItemView` (22sp); on Android the line heights are unchanged. Skia draws the baseline of a line at its top plus the rounded ascent and reports the rounded line height less the descent, which Compose rounds into `FirstBaseline` and `LastBaseline`; both are one pixel row only when ascent and descent add up to whole pixels, so the time, placed by reported baselines, is drawn on the baseline of the text (owner report); with Skia m138 it is drawn 1 px from it at some font scales (`BubbleLayoutTest.timeOffsetFromTextBaseline`). - `BUBBLE_TEXT_INSET` (11dp, user) is the distance from a bubble or band edge to the capitals of the text under it, and from the last baseline to the edge under it; in dp, so it keeps its size at larger fonts (user). Message text, captions and an emoji under a quote or header have [`bubbleTextBoxPadding()`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt#L575-L582): that inset less the space of 16sp text with the full line height above its capitals (`BUBBLE_LINE_ABOVE_CAPS`, 6sp) and under its last baseline (`BUBBLE_LINE_BELOW_BASELINE`, 4.375sp), at least 0; 5dp and 6.625dp at font scale 1. `BUBBLE_SIDE_INSET` (14dp, user) is the distance from the bubble sides to message text, captions, an emoji under a quote or header and the end of the time. Header bands, the quote band and deleted and error items use [`Modifier.bubbleTextPadding(firstLineFontSize, bottom)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt#L571-L573): `BUBBLE_SIDE_INSET` at the sides and the inset by the first and last baselines; a header followed by a quote or a forwarded header has no inset below. The header starts at `BUBBLE_SIDE_INSET` and its icon takes no height. Deleted and error items are drawn by [`ItemTextCard`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/DeletedItemView.kt#L33-L52) (`DeletedItemView`, `MarkedDeletedItemView`, `CIMsgError`) and the private `DecryptionErrorCard` (the decryption error items), each with one switch between the bubble and the rounded card of terminal rows: in bubbles they fill the shape of `clipChatItem` (`Surface` with its default `RectangleShape`, user). That shape has no tail for items without message content ([`shapeStyleWithTail`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt#L1334-L1386): `msgContent` null; user): deleted, moderated, blocked, error, decryption error and invalid JSON items. [`chatItemTailRendered(chatItem, tailVisible, revealed)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt#L1222-L1224) tells whether the tail is drawn, from the shape style of the item as `clipChatItem` computes it; `FramedItemView`, `chatItemOffset` and the sender rows of `ChatItemsList` use it. The file row ends `BUBBLE_TEXT_INSET` under the baseline of its size line; the ink bottom of the file icon is aligned to that baseline ([`fileIconOnBaseline`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/CIFileView.kt#L258-L262): the icon size × `FILE_ICON_INK_INSET`, the space under the ink of `ic_draft_filled`, rounded down). - The time: [`Modifier.bubbleMeta()`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt#L584-L588) places the baseline of the time `BUBBLE_TEXT_INSET` above the bubble bottom, on the last baseline of the text; ticks without a time where they stand next to a time (`metaBaseline`, shared with `TerminalMetaLayout`). In deleted and error items the time follows the text on its last baseline (`bubbleMetaOnBaseline`, the text aligned by `LastBaseline`), so a wrapped text keeps the time on its last line; in group invitations [`MetaOnLastBaseline(meta, content)`](../../common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt#L596-L608) places it at the end of the card on its last baseline (the card bottom without a baseline, in intrinsic measurement; user). Message text, an emoji under a quote or header, decryption errors and group invitations end with `metaReserveCopy`; after text it starts with a breaking space (`breakBefore`), so the time alone moves to the next line, except in group invitations, where the word joiner keeps the time with the last word (user); the size line of a file keeps the string of `reserveSpaceForMeta`. - Gaps between rows: `BUBBLE_CLOSE_GAP` (2sp) between close messages, `BUBBLE_FAR_GAP` (8sp) at a large gap, half above and half below each row. Event rows (`isEvent`: items without a sender, `hasTerminalSender` false, other than the chat banner: event, feature, preference and end-to-end encryption items, also collapsed) form runs (user): `eventRunLargeGap` makes the gap between two events close and the gap between an event and another row large; `ChatItemsList` applies it to the gap above a row (`eventGapAbove`) and to the separation below it (`eventGapBelow`, a large gap with the time), so a message above an event shows its tail and time. The avatar column of an event has no 8dp top padding. diff --git a/plans/2026-11-13-linux-fallback-font-crash.md b/plans/2026-11-13-linux-fallback-font-crash.md new file mode 100644 index 0000000000..3891c47dfc --- /dev/null +++ b/plans/2026-11-13-linux-fallback-font-crash.md @@ -0,0 +1,33 @@ +# Linux: prevent crash with bitmap and WOFF2 fallback fonts + +## Behaviour + +On Linux the desktop app lays out text whose fallback font is a PCF, BDF, PFR, Windows FNT, Type 42 or WOFF2 font without that font. + +## Fix + +`apps/multiplatform/build.gradle.kts` resolves every `org.jetbrains.skiko` module requested at 0.9.4.2 (Skia m132) to 0.9.24 (Skia m138), on all desktop OSes. Skia m138 skips a font that its font scanner does not load. + +- Compose 1.8.2 links against 0.9.24: every Skiko class, method and field referenced in the constant pools of the Compose 1.8.2 and library jars exists in 0.9.24. +- The rule applies only to 0.9.4.2, so a Compose update that brings another Skiko version is not overridden. +- Skiko 0.9.24 adds `org.jetbrains.runtime:jbr-api` 1.5.0 to the desktop runtime; its Linux library requires glibc 2.29 (0.9.4.2: 2.17), below the 2.35 of Ubuntu 22.04, where the releases are built. +- Android is unchanged. + +## Text rendering + +Skia m138 adds the paragraph's default metrics to every line (`TextWrapper.cpp` of JetBrains Skia), so a line in a smaller span or another font can move by 1 px. + +| OS | Previews that differ from m132 | Change | +|---|---|---| +| Windows, measured on master | 25 of 262 | 1 px vertical shifts; Segoe UI Emoji drawn from its COLR v1 table | +| macOS, measured on master | 23 of 262 | 1 px vertical shifts | +| Linux | 57 of 260 | 1 px vertical shifts and FreeType glyph pixels; lines with an emoji 1 px taller | + +On Windows and macOS no preview changes size; on Linux the chat help is 2 px taller. + +## Tests + +- `FallbackFontTest` builds a fontconfig cache for one BDF font with `fc-cache`, then lays out U+2603 in a child JVM. +- `Dockerfile.build` installs `fontconfig`, which provides `fc-cache` in CI. +- `BubbleLayoutTest.timeOffsetFromTextBaseline` asserts the offset of the time from the text baseline for each text style and font scale: 0 px, or 1 px either way in 6 of 27 cases. +- The 57 desktop snapshot references that differ by more than the comparison tolerance are re-recorded with Skiko 0.9.24. diff --git a/scripts/ci/README.md b/scripts/ci/README.md index d4814235bb..09af10a2ad 100644 --- a/scripts/ci/README.md +++ b/scripts/ci/README.md @@ -67,7 +67,7 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve cd apps/multiplatform ./gradlew --no-daemon --max-workers=1 :common:desktopTest :desktop:compileKotlinJvm -x :desktop:cmakeBuildAndCopy :android:compileGoogleDebugKotlin :android:testFossDebugUnitTest ``` - JDK 17 and an Android SDK in ANDROID_HOME are required, as installed by Dockerfile.build. + JDK 17 and an Android SDK in ANDROID_HOME are required, and on Linux fontconfig's `fc-cache` for `FallbackFontTest`, as installed by Dockerfile.build. #### ios