Skip to content

Added support for BackgroundTextMeasurement in all Platforms - #3238

Draft
Apolo (ApoloApps) wants to merge 5 commits into
JetBrains:jb-mainfrom
ApoloApps:backgroungTextMeasurementExecutorSupport
Draft

Added support for BackgroundTextMeasurement in all Platforms#3238
Apolo (ApoloApps) wants to merge 5 commits into
JetBrains:jb-mainfrom
ApoloApps:backgroungTextMeasurementExecutorSupport

Conversation

@ApoloApps

Copy link
Copy Markdown

Support BackgroundTextMeasurement by adding a Platform* interface. It typealiases in JVM to Executor. This PR is a copy of the Android Api ported to Multiplatform.

I leave it up to you, CMP team, to add platform-specific implementations based in the possible performance gains it can provide. In JVM, LocalPlatformBackgroundTextMeasurementExecutor can be Executors.newSingleThreadExecutor() (as per Android KDoc)

Lays foundation for https://youtrack.jetbrains.com/issue/CMP-7818

Testing

(Optional) Describe how you tested your changes (provide a snippet or/and steps)

(Optional) This should be tested by QA

Release Notes

N/A

import kotlinx.coroutines.Runnable

@InternalComposeUiApi
expect interface PlatformBackgroundTextMeasurementExecutor {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect interface is wrong API shape/antipattern that we're trying to avoid (I know that we still have a few in the codebase)

val density = LocalDensity.current

try {
val task = Runnable {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMP-10613 is a blocker to run it in parallel (and merge this PR before fixing it)

@ApoloApps
Apolo (ApoloApps) marked this pull request as draft August 24, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants