Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Setting LineHeight using dp instead of sp breaks vertical spacing #86

@malinajirka

Description

@malinajirka

When I

  • set lineHeight to 44dp to for example Headline3 style
  • update the headline 3 text so it is longer then one line here

The vertical spacing completely breaks - there is a huge (cca 1000dp) line spacing instead of 44dp. Using sp instead of dp fixes the issue.

Patch

Index: sample/src/main/java/com/google/android/material/composethemeadapter/sample/MaterialIntegration.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sample/src/main/java/com/google/android/material/composethemeadapter/sample/MaterialIntegration.kt b/sample/src/main/java/com/google/android/material/composethemeadapter/sample/MaterialIntegration.kt
--- a/sample/src/main/java/com/google/android/material/composethemeadapter/sample/MaterialIntegration.kt	(revision 2f8d91620d72d4c7ff464edeb094d04d246b4270)
+++ b/sample/src/main/java/com/google/android/material/composethemeadapter/sample/MaterialIntegration.kt	(date 1640865711026)
@@ -130,7 +130,7 @@
                 style = MaterialTheme.typography.h2
             )
             Text(
-                text = "Headline 3",
+                text = "Headline 3 LONG HEADLINE",
                 style = MaterialTheme.typography.h3
             )
             Text(
Index: sample/src/main/res/values/type.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sample/src/main/res/values/type.xml b/sample/src/main/res/values/type.xml
--- a/sample/src/main/res/values/type.xml	(revision 2f8d91620d72d4c7ff464edeb094d04d246b4270)
+++ b/sample/src/main/res/values/type.xml	(date 1640865736222)
@@ -19,6 +19,7 @@
     <style name="TextAppearance.Sample.Headline3"
         parent="TextAppearance.MaterialComponents.Headline3">
         <item name="fontFamily">@font/dancingscript</item>
+        <item name="lineHeight">44dp</item>
     </style>
 
     <!-- Use TextAppearance.AppCompat.Subhead as parent to avoid inheriting letterSpacing -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions