https://kotlinlang.org logo
#compose
Title
# compose
a

alorma

01/28/2022, 11:45 AM
Hi! I know this may be a ... dummy question about texts, but I'm running out if ideas here. We have a chip, created by
Surface
and
Text
inside it, text is in a
Row
, centered both horizontal and vertical. We see a small pixel.. difference, as it should be on the center, and we see here that text is a bit under the center.. Any idea?
j

Javier

01/28/2022, 12:06 PM
font padding?
a

alorma

01/28/2022, 12:07 PM
uhmmmm doesn't look like it...
Copy code
internal val ijBody2: TextStyle = TextStyle(
  fontSize = 14.sp,
  fontFamily = FontFamily.SansSerif,
  fontStyle = FontStyle.Normal,
  fontWeight = FontWeight.Normal,
  lineHeight = 16.sp,
  letterSpacing = 0.1.sp,
)
this is our style for that screenshot case
j

Javier

01/28/2022, 12:08 PM
the font itself has a padding, not added by compose
a

alorma

01/28/2022, 12:09 PM
uhm, we are not defining a font, so maybe the system font has padding... :S
Roboto has padding
a

alorma

01/28/2022, 12:11 PM
yes...
uhm, it looks like. using "textALign = TextALign.Center" does the magic
f

Filip Wiesner

01/28/2022, 12:14 PM
TextAlign
should be horizontal align. There is feature request on google tracker about the font padding already if you search for it.
a

alorma

01/28/2022, 12:16 PM
yea yea, found it
anyway, if there's an issue and someone working on it, we can live with it by now