Skip to content

Text has inconsistent padding between Android/Desktop #4508

@zoltish

Description

@zoltish

Describe the bug
Text on desktop has inconsistent top/bottom "padding". The Lato font family is what led me here and what you can see in the screenshots below.

Affected platforms

  • Desktop: Windows

Versions

  • Kotlin version*: 2.0.0-Beta04
  • Compose Multiplatform version*: 1.6.1
  • OS version(s)* (required for Desktop and iOS issues): 11
  • OS architecture (x86 or arm64): x86
  • JDK (for desktop issues): 17

To Reproduce
Render a BasicText like this where fontFamily uses Lato or Roboto.

                BasicText(
                    text = "123",
                    modifier = Modifier.background(Color.Black),
                    color = { Color.White },
                    style = TextStyle.Default.merge(
                        fontSize = 124.sp,
                        fontFamily = fontFamily(),
                    ),
                )

Expected behavior
The text is centered vertically.

Screenshots
Android (correct):
android
Desktop (incorrect):
desktop

Additional context

  • Its been like this for quite some time, I just havent brought it up since it works flawlessly on Android (my main target for now).
  • I previously thought some font families worked (Roboto) but that doesnt seem to be the case. Specifying TextStyle.merge(fontSize = 132.sp) does result in the correct padding with roboto, but not with lato.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions