Composables UI is out: our new component library for Compose Multiplatform ->
Class

RemoteDensity

Represents the screen density and font scale factor used for unit conversions in a remote composition context.

Source set: Android
public class RemoteDensity(public val density: RemoteFloat, public val fontScale: RemoteFloat)

Represents the screen density and font scale factor used for unit conversions in a remote composition context. Similar to Compose Density.

Functions

toPx

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun TextUnit.toPx(): RemoteFloat

Converts a TextUnit to pixels using this RemoteDensity.

toPx

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun Dp.toPx(): RemoteFloat

Converts a Dp to pixels using this RemoteDensity.

Companion Object

Properties

Source set: Android
public val Host: RemoteDensity

A RemoteDensity instance that represents the host's screen density, with font scale derived from the host's system font size and density settings.

Methods

Source set: Android
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun from(creationDisplayInfo: RemoteCreationDisplayInfo): RemoteDensity

Creates a RemoteDensity instance from the provided RemoteCreationDisplayInfo.

Parameters

creationDisplayInfo The display information containing the screen density and font scale.

Returns

A RemoteDensity instance with the density and font scale from the display info.

Last updated: