Status Update
Comments
si...@google.com <si...@google.com> #2
but the fontStyle and fontFamily parameters are not. I expected "World" to display as bold, italic and monospace.
+1, it sounds like a bug and agree that fontStyle
and fontFamily
should be carried as long as they are note overridden
Note also how textDecoration = TextDecoration.LineThrough from the annotated string and TextDecoration.Underline on the Text combine
This also sounds like a bug (especially for a case where Text has LineThrough, AnnotatedString has TextDecoration.None, where the intention is "this part of the text should not have a text decoration)
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
ha...@google.com <ha...@google.com>
ap...@google.com <ap...@google.com> #3
Branch: androidx-main
commit 28810a41432e2fc8713e0a4b59ac311d9db77eb3
Author: Haoyu Zhang <haoyuchang@google.com>
Date: Fri Apr 09 16:04:52 2021
Read global font attributes when resolve font attributes on AnnotatedString
Also introduced screenshot test for styled text.
Bug: 184760917
Test: ./gradlew test
Change-Id: I8f21298ffd551f0963e11b059412f0c582dc9dd6
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
ha...@google.com <ha...@google.com>
ap...@google.com <ap...@google.com> #4
Branch: androidx-main
commit eeff527b7ec6ca2accb0163696098d2765076262
Author: Haoyu Zhang <haoyuchang@google.com>
Date: Thu Apr 29 11:13:41 2021
Make SpanStyle merge logic on AnnotatedString consistent
Bug: 184760917
Test: ./gradlew test
Test: ./gradlew compose:ui:ui-text:connectedAndroidTest
RelNote: "TextGeomerticTransform and TextDecoration on AnnotatedString
will be applied as given."
Change-Id: I61900b749deafc1570dc329a64d1050fd52b20a2
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphTest.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
A text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt
ex...@gmail.com <ex...@gmail.com> #5
I tried this on beta06 (assuming that's where the fix went) and fontStyle
and fontFamily
now apply as expected. However, I still get underlining AND linethrough on "World". I wanted to confirm that it is your intention to combine them, based on the comments above.
Playing with the example further:
- Changing the
Text
toTextDecoration.None
results in no decoration on "Hello" but a linethrough on "World" (seems reasonable -- annotated overrides Text) - Changing the annotated "World" to
TextDecoration.None
and theText
toTextDecoration.LineThrough
(as suggested in the comments above) results in a linethrough on "Hello World" (seems inconsistent -- shouldn't "World" have no decoration?)
(And sometimes, oddly, I have to uninstall the test app manually in the emulator before the new code will take effect.)
ha...@google.com <ha...@google.com> #6
Hi, thanks for your report! The fixing CL for TextDeocration and LineThrough was just merged recently. And it's probably not included in the beta-06, can you please check it again in next release?
ex...@gmail.com <ex...@gmail.com> #7
OK, I will. (I had assumed that since the result had changed from the last time I ran the testcase that this fix was applied, but maybe some other change was responsible.)
ex...@gmail.com <ex...@gmail.com> #8
The fix works as expected in beta07.
(I still occasionally have to uninstall the test app manually in the emulator before the new code will take effect. I'm sure this is an AS issue but it seems to hit mostly (only?) when I've been running this test.)
ha...@google.com <ha...@google.com> #9
Thanks for the confirmation! I'll mark it as verified for now. :)
Description
AS Canary 13, beta04
There are some inconsistencies when
Text
parameters are combined with anAnnotatedString
input. In the example below (see screenshot as well) thefontSize
,textDecoration
,color
, andletterSpacing
parameters ofText
are applied to the whole annotated text, but thefontStyle
andfontFamily
parameters are not. I expected "World" to display as bold, italic and monospace.Note also how
textDecoration = TextDecoration.LineThrough
from the annotated string andTextDecoration.Underline
on theText
combine, which seems reasonable, until you consider attributes likecolor
, which override:color
specified in annotated text overrides the parametercolor
inText
for the annotated portion, as expected (not shown in example).