textflow icon indicating copy to clipboard operation
textflow copied to clipboard

Drop cap spacing issue

Open hamen opened this issue 2 years ago • 2 comments

Hi all, we are seeing a glitch with the drop cap:

The last line of the drop cap and the first line of the full-width text seem to have a wrong spacing. Is there actually a problem in lib, or am I holding it wrong?

This is my current implementation:

    TextFlow(
        text = story.text.substring(1),
        modifier = Modifier
            .fillMaxWidth()
            .padding(16.dp)
            .let {
                when (windowSizeClass.widthSizeClass) {
                    WindowWidthSizeClass.Compact -> it
                    else -> it.requiredWidth(600.dp)
                }
            },
        style = MaterialTheme.typography.bodyLarge,
        color = MaterialTheme.colorScheme.onSurface,
        fontFamily = fontFamily,
    ) {
        Text(
            text = story.text.substring(0, 1),
            fontFamily = FontFamily(Font(R.font.griffin_two_plain)),
            fontSize = 74.sp,
        )
    }

Thanks 🙏

hamen avatar Aug 31 '23 13:08 hamen

Hey 👋

Thx for trying a lib, I have seen it in AI Bedtime Stories 😄 Awesome idea, btw 👍

Looks like you are using M3, but TextFlow is build on M2, this could cause some issues 🤔 I am playing around with an idea to release also M3 version as a separate artifact.

However, I have several question:

  1. Which version of Compose you are using?
  2. Do you override includeFontPadding setting in PlatformTextStyle for your typography?
  3. Could you share your font family used for TextFlow?
  4. Could you share your typography setup?

Thanks in advance 🤌

oleksandrbalan avatar Aug 31 '23 15:08 oleksandrbalan

@hamen Hey 👋

Just a friendly ping, if you have time to check it? ☝️

oleksandrbalan avatar Oct 17 '23 16:10 oleksandrbalan