Add Unit Em
Bug: 139312484
Test: ./gradlew test
Change-Id: Ie3c229a699422048418f4addb3a7218473a96c95
diff --git a/ui/ui-text/api/0.1.0-dev02.txt b/ui/ui-text/api/0.1.0-dev02.txt
index 97cb363..1db2c31 100644
--- a/ui/ui-text/api/0.1.0-dev02.txt
+++ b/ui/ui-text/api/0.1.0-dev02.txt
@@ -256,7 +256,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -272,8 +272,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -285,7 +285,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/api/api_lint.ignore b/ui/ui-text/api/api_lint.ignore
index d274e17..ce38571 100644
--- a/ui/ui-text/api/api_lint.ignore
+++ b/ui/ui-text/api/api_lint.ignore
@@ -3,22 +3,14 @@
Must avoid boxed primitives (`java.lang.Integer`)
AutoBoxing: androidx.ui.text.ParagraphKt#Paragraph(androidx.ui.text.ParagraphIntrinsics, Integer, Boolean, androidx.ui.text.ParagraphConstraints) parameter #1:
Must avoid boxed primitives (`java.lang.Integer`)
-AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #2:
- Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #8:
+AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, androidx.ui.core.Em, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #2:
Must avoid boxed primitives (`java.lang.Float`)
AutoBoxing: androidx.ui.text.TextStyle#component3():
Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#component9():
- Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #2:
- Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #8:
+AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, androidx.ui.core.Em, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.graphics.Shadow) parameter #2:
Must avoid boxed primitives (`java.lang.Float`)
AutoBoxing: androidx.ui.text.TextStyle#getFontSizeScale():
Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#getLetterSpacing():
- Must avoid boxed primitives (`java.lang.Float`)
AutoBoxing: androidx.ui.text.style.TextGeometricTransform#TextGeometricTransform(Float, Float) parameter #0:
Must avoid boxed primitives (`java.lang.Float`)
AutoBoxing: androidx.ui.text.style.TextGeometricTransform#TextGeometricTransform(Float, Float) parameter #1:
diff --git a/ui/ui-text/api/current.txt b/ui/ui-text/api/current.txt
index 97cb363..1db2c31 100644
--- a/ui/ui-text/api/current.txt
+++ b/ui/ui-text/api/current.txt
@@ -256,7 +256,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -272,8 +272,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -285,7 +285,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/api/public_plus_experimental_0.1.0-dev02.txt b/ui/ui-text/api/public_plus_experimental_0.1.0-dev02.txt
index 97cb363..1db2c31 100644
--- a/ui/ui-text/api/public_plus_experimental_0.1.0-dev02.txt
+++ b/ui/ui-text/api/public_plus_experimental_0.1.0-dev02.txt
@@ -256,7 +256,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -272,8 +272,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -285,7 +285,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/api/public_plus_experimental_current.txt b/ui/ui-text/api/public_plus_experimental_current.txt
index 97cb363..1db2c31 100644
--- a/ui/ui-text/api/public_plus_experimental_current.txt
+++ b/ui/ui-text/api/public_plus_experimental_current.txt
@@ -256,7 +256,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -272,8 +272,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -285,7 +285,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/api/restricted_0.1.0-dev02.txt b/ui/ui-text/api/restricted_0.1.0-dev02.txt
index 2d639d4..6ab84fe 100644
--- a/ui/ui-text/api/restricted_0.1.0-dev02.txt
+++ b/ui/ui-text/api/restricted_0.1.0-dev02.txt
@@ -293,7 +293,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -309,8 +309,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -322,7 +322,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/api/restricted_current.txt b/ui/ui-text/api/restricted_current.txt
index 2d639d4..6ab84fe 100644
--- a/ui/ui-text/api/restricted_current.txt
+++ b/ui/ui-text/api/restricted_current.txt
@@ -293,7 +293,7 @@
}
public final class TextStyle {
- ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
ctor public TextStyle();
method public androidx.ui.graphics.Color? component1();
method public androidx.ui.text.style.BaselineShift? component10();
@@ -309,8 +309,8 @@
method public androidx.ui.text.font.FontSynthesis? component6();
method public androidx.ui.text.font.FontFamily? component7();
method public String? component8();
- method public Float? component9();
- method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
+ method public androidx.ui.core.Em? component9();
+ method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, androidx.ui.core.Em? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.graphics.Shadow? shadow);
method public androidx.ui.graphics.Color? getBackground();
method public androidx.ui.text.style.BaselineShift? getBaselineShift();
method public androidx.ui.graphics.Color? getColor();
@@ -322,7 +322,7 @@
method public androidx.ui.text.font.FontStyle? getFontStyle();
method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
method public androidx.ui.text.font.FontWeight? getFontWeight();
- method public Float? getLetterSpacing();
+ method public androidx.ui.core.Em? getLetterSpacing();
method public androidx.ui.text.LocaleList? getLocaleList();
method public androidx.ui.graphics.Shadow? getShadow();
method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
diff --git a/ui/ui-text/integration-tests/samples/src/main/java/androidx/ui/text/samples/TextStyleSamples.kt b/ui/ui-text/integration-tests/samples/src/main/java/androidx/ui/text/samples/TextStyleSamples.kt
index 877b45e..1998704 100644
--- a/ui/ui-text/integration-tests/samples/src/main/java/androidx/ui/text/samples/TextStyleSamples.kt
+++ b/ui/ui-text/integration-tests/samples/src/main/java/androidx/ui/text/samples/TextStyleSamples.kt
@@ -19,6 +19,7 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.ui.core.Text
+import androidx.ui.core.em
import androidx.ui.core.sp
import androidx.ui.graphics.Color
import androidx.ui.text.TextStyle
@@ -38,7 +39,7 @@
fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.W800,
fontStyle = FontStyle.Italic,
- letterSpacing = 0.5f,
+ letterSpacing = 0.5.em,
background = Color.LightGray,
decoration = TextDecoration.Underline
)
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
index b2b2c34..cb3eb92 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
@@ -37,6 +37,7 @@
import androidx.ui.text.TextStyle
import androidx.ui.text.style.TextOverflow
import androidx.ui.core.Sp
+import androidx.ui.core.em
import androidx.ui.core.sp
import androidx.ui.text.LocaleList
import androidx.ui.text.samples.BaselineShiftSample
@@ -267,7 +268,7 @@
text = displayText,
style = TextStyle(
fontSize = fontSize8,
- letterSpacing = 0.5f
+ letterSpacing = 0.5.em
)
)
}
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
index 51a0e6a..50c660c 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -22,6 +22,7 @@
import androidx.ui.core.Density
import androidx.ui.core.PxPosition
import androidx.ui.core.Sp
+import androidx.ui.core.em
import androidx.ui.core.px
import androidx.ui.core.sp
import androidx.ui.core.withDensity
@@ -2348,7 +2349,7 @@
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
val letterSpacing = 5.0f
- val textStyle = TextStyle(letterSpacing = letterSpacing)
+ val textStyle = TextStyle(letterSpacing = letterSpacing.em)
val paragraphWidth = fontSizeInPx * (1 + letterSpacing) * text.length
val paragraph = simpleParagraph(
@@ -2373,7 +2374,7 @@
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
val letterSpacing = 5.0f
- val textStyle = TextStyle(letterSpacing = letterSpacing)
+ val textStyle = TextStyle(letterSpacing = letterSpacing.em)
val paragraphWidth = fontSizeInPx * (1 + letterSpacing) * text.length
val paragraph = simpleParagraph(
@@ -2398,11 +2399,11 @@
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
val letterSpacing = 5.0f
- val textStyle = TextStyle(letterSpacing = letterSpacing)
+ val textStyle = TextStyle(letterSpacing = letterSpacing.em)
val letterSpacingOverwrite = 10.0f
val textStyleOverwrite =
- TextStyle(letterSpacing = letterSpacingOverwrite)
+ TextStyle(letterSpacing = letterSpacingOverwrite.em)
val paragraphWidth = fontSizeInPx * (1 + letterSpacingOverwrite) * text.length
val paragraph = simpleParagraph(
@@ -2625,7 +2626,7 @@
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
val letterSpacing = 1f
- val textStyle = TextStyle(letterSpacing = letterSpacing)
+ val textStyle = TextStyle(letterSpacing = letterSpacing.em)
val paragraph = simpleParagraph(
text = text,
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
index 7afacb2..e28d153 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
@@ -21,6 +21,7 @@
import androidx.text.style.SkewXSpan
import androidx.text.style.TypefaceSpan
import androidx.ui.core.Density
+import androidx.ui.core.em
import androidx.ui.core.px
import androidx.ui.core.sp
import androidx.ui.core.withDensity
@@ -330,7 +331,7 @@
fun testAnnotatedString_setLetterSpacingOnWholeText() {
val text = "abcde"
val letterSpacing = 2.0f
- val textStyle = TextStyle(letterSpacing = letterSpacing)
+ val textStyle = TextStyle(letterSpacing = letterSpacing.em)
val paragraph = simpleParagraph(
text = text,
@@ -345,7 +346,7 @@
@Test
fun testAnnotatedString_setLetterSpacingOnPartText() {
val text = "abcde"
- val textStyle = TextStyle(letterSpacing = 2.0f)
+ val textStyle = TextStyle(letterSpacing = 2.em)
val paragraph = simpleParagraph(
text = text,
@@ -360,8 +361,8 @@
@Test
fun testAnnotatedString_setLetterSpacingTwice_lastOneOverwrite() {
val text = "abcde"
- val textStyle = TextStyle(letterSpacing = 2.0f)
- val textStyleOverwrite = TextStyle(letterSpacing = 3.0f)
+ val textStyle = TextStyle(letterSpacing = 2.em)
+ val textStyleOverwrite = TextStyle(letterSpacing = 3.em)
val paragraph = simpleParagraph(
text = text,
@@ -1035,10 +1036,10 @@
@Test
fun testTextStyle_letterSpacing_appliedOnTextPaint() {
- val letterSpacing = 2.0f
+ val letterSpacing = 2
val paragraph = simpleParagraph(
text = "",
- textStyle = TextStyle(letterSpacing = letterSpacing),
+ textStyle = TextStyle(letterSpacing = letterSpacing.em),
constraints = ParagraphConstraints(width = 0.0f)
)
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
index df82ada..60859fc 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
@@ -16,7 +16,9 @@
package androidx.ui.text
+import androidx.ui.core.Em
import androidx.ui.core.Sp
+import androidx.ui.core.em
import androidx.ui.core.sp
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shadow
@@ -68,7 +70,7 @@
val fontSynthesis: FontSynthesis? = null,
var fontFamily: FontFamily? = null,
val fontFeatureSettings: String? = null,
- val letterSpacing: Float? = null,
+ val letterSpacing: Em? = null,
val baselineShift: BaselineShift? = null,
val textGeometricTransform: TextGeometricTransform? = null,
val localeList: LocaleList? = null,
@@ -131,6 +133,13 @@
return androidx.ui.core.lerp(start, end, t)
}
+ private fun lerpEm(a: Em?, b: Em?, t: Float, default: Em = 0f.em): Em? {
+ if (a == null && b == null) return null
+ val start = a ?: default
+ val end = b ?: default
+ return androidx.ui.core.lerp(start, end, t)
+ }
+
private fun <T> lerpDiscrete(a: T?, b: T?, t: Float): T? = if (t < 0.5) a else b
/**
@@ -213,7 +222,7 @@
stop.fontFeatureSettings,
fraction
),
- letterSpacing = lerpFloat(
+ letterSpacing = lerpEm(
start.letterSpacing,
stop.letterSpacing,
fraction
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
index 2b5dcbf..2bb4282 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
@@ -98,7 +98,7 @@
}
style.letterSpacing?.let {
- letterSpacing = it
+ letterSpacing = it.value
}
style.fontFeatureSettings?.let {
@@ -281,7 +281,7 @@
// TODO(haoyuchang): support letter spacing with pixel.
style.letterSpacing?.let {
spannableString.setSpan(
- LetterSpacingSpan(it),
+ LetterSpacingSpan(it.value),
start,
end,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/AnnotatedStringBuilderTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/AnnotatedStringBuilderTest.kt
index 40d2daa..e66e09c 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/AnnotatedStringBuilderTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/AnnotatedStringBuilderTest.kt
@@ -17,6 +17,7 @@
package androidx.ui.text
import androidx.ui.core.Sp
+import androidx.ui.core.em
import androidx.ui.core.sp
import androidx.ui.graphics.Color
import androidx.ui.text.font.FontStyle
@@ -281,7 +282,7 @@
TextStyle(color = Color.Red),
TextStyle(fontStyle = FontStyle.Italic),
TextStyle(fontWeight = FontWeight.Bold),
- TextStyle(letterSpacing = 1.2f)
+ TextStyle(letterSpacing = 1.2.em)
)
val buildResult = with(AnnotatedString.Builder()) {
@@ -313,7 +314,7 @@
TextStyle(color = Color.Red),
TextStyle(fontStyle = FontStyle.Italic),
TextStyle(fontWeight = FontWeight.Bold),
- TextStyle(letterSpacing = 1.2f)
+ TextStyle(letterSpacing = 1.2.em)
)
val buildResult = with(AnnotatedString.Builder()) {
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextSpanTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextSpanTest.kt
index 1502bc9..598adfb 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextSpanTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextSpanTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.text
+import androidx.ui.core.em
import androidx.ui.core.sp
import androidx.ui.graphics.Color
import com.google.common.truth.Truth.assertThat
@@ -39,7 +40,7 @@
@Test
fun `constructor with customized style`() {
- val textStyle = TextStyle(fontSize = 10.sp, letterSpacing = 1.5f)
+ val textStyle = TextStyle(fontSize = 10.sp, letterSpacing = 1.5.em)
val textSpan = TextSpan(style = textStyle)
assertThat(textSpan.style).isEqualTo(textStyle)
@@ -207,7 +208,7 @@
fun `compareTo with one null style should return LAYOUT`() {
val textSpan1 = TextSpan()
val textSpan2 =
- TextSpan(style = TextStyle(letterSpacing = 1.5f))
+ TextSpan(style = TextStyle(letterSpacing = 1.5.em))
assertThat(textSpan1.compareTo(textSpan2)).isEqualTo(RenderComparison.LAYOUT)
}
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
index fe6831e..ad56088 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.text
+import androidx.ui.core.em
import androidx.ui.core.px
import androidx.ui.core.sp
import androidx.ui.engine.geometry.Offset
@@ -90,7 +91,7 @@
@Test
fun `constructor with customized letterSpacing`() {
- val letterSpacing = 1.0f
+ val letterSpacing = 1.em
val textStyle = TextStyle(letterSpacing = letterSpacing)
@@ -317,7 +318,7 @@
@Test
fun `merge with other's letterSpacing is null should use this' letterSpacing`() {
- val letterSpacing = 1.2f
+ val letterSpacing = 1.2.em
val textStyle = TextStyle(letterSpacing = letterSpacing)
val otherTextStyle = TextStyle()
@@ -328,8 +329,8 @@
@Test
fun `merge with other's letterSpacing is set should use other's letterSpacing`() {
- val letterSpacing = 1.2f
- val otherLetterSpacing = 1.5f
+ val letterSpacing = 1.2.em
+ val otherLetterSpacing = 1.5.em
val textStyle = TextStyle(letterSpacing = letterSpacing)
val otherTextStyle = TextStyle(letterSpacing = otherLetterSpacing)
@@ -978,7 +979,7 @@
@Test
fun `lerp letterSpacing with a is Null and t is smaller than half`() {
- val letterSpacing = 2.0f
+ val letterSpacing = 2.em
val t = 0.3f
val textStyle = TextStyle(letterSpacing = letterSpacing)
@@ -989,7 +990,7 @@
@Test
fun `lerp letterSpacing with a is Null and t is larger than half`() {
- val letterSpacing = 2.0f
+ val letterSpacing = 2.em
val t = 0.8f
val textStyle = TextStyle(letterSpacing = letterSpacing)
@@ -1000,7 +1001,7 @@
@Test
fun `lerp letterSpacing with b is Null and t is smaller than half`() {
- val letterSpacing = 2.0f
+ val letterSpacing = 2.em
val t = 0.3f
val textStyle = TextStyle(letterSpacing = letterSpacing)
@@ -1011,7 +1012,7 @@
@Test
fun `lerp letterSpacing with b is Null and t is larger than half`() {
- val letterSpacing = 2.0f
+ val letterSpacing = 2.em
val t = 0.8f
val textStyle = TextStyle(letterSpacing = letterSpacing)
@@ -1374,7 +1375,7 @@
fontWeight = FontWeight.W800,
fontStyle = FontStyle.Italic,
fontFeatureSettings = fontFeatureSettings,
- letterSpacing = 1.0f,
+ letterSpacing = 1.em,
baselineShift = BaselineShift.Subscript,
textGeometricTransform = TextGeometricTransform(scaleX = 1.0f),
localeList = LocaleList("en-US"),
@@ -1405,7 +1406,7 @@
assertThat(textStyle.compareTo(textStyle.copy(fontFeatureSettings = null)))
.isEqualTo(RenderComparison.LAYOUT)
- assertThat(textStyle.compareTo(textStyle.copy(letterSpacing = 2.0f)))
+ assertThat(textStyle.compareTo(textStyle.copy(letterSpacing = 2.em)))
.isEqualTo(RenderComparison.LAYOUT)
assertThat(textStyle.compareTo(textStyle.copy(baselineShift = BaselineShift.Superscript)))
@@ -1433,7 +1434,7 @@
fontSize = fontSize,
fontWeight = FontWeight.W800,
fontStyle = FontStyle.Italic,
- letterSpacing = 1.0f,
+ letterSpacing = 1.em,
baselineShift = BaselineShift.Superscript,
textGeometricTransform = TextGeometricTransform(null, null),
localeList = LocaleList("en-US"),