Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [iOS] FlowDirection does not justify text on a label correctly when LineHeight is set to a value greater than 0 #13572

Closed
IcemarkUK opened this issue Jan 28, 2021 · 3 comments
Labels
s/unverified New report that has yet to be verified t/bug 🐛
Projects

Comments

@IcemarkUK
Copy link

FlowDirection does not justify text on a label correctly when LineHeight is set to a value greater than 0

Steps to Reproduce

  1. Create a page with FlowDirection set to RightToLeft
  2. Create a label with HorizontalTextAlignment set to Start or default to Start
  3. Set label LineHeight to 1.0
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="TestRTL.MainPage"
    FlowDirection="RightToLeft">
    <StackLayout
        Padding="8,0,8,0"
        VerticalOptions="Center"
        Spacing="16">
        <Label
            Text="Correct"
            FontSize="32"/>
        <Label
            Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
            FontSize="16"/>
        <Label
            Text="Incorrect"
            FontSize="32"
            LineHeight="1.0"/>
        <Label
            Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
            FontSize="16"
            LineHeight="1.0"/>
    </StackLayout>
</ContentPage>

Expected Behavior

Label with a Start Horizontal Alignment should be right justified

Actual Behavior

Label with a Start Horizontal Alignment is still left justified

Basic Information

  • Version with issue: 4.8.0.1451 and 5.0.0.1931
  • Last known good version: unknown
  • Platform Target Frameworks:
    • iOS: 14.4
  • NuGet Packages:
  • Affected Devices: iPhone/iPad

Environment

Show/Hide Visual Studio info
=== Visual Studio Community 2019 for Mac ===

Version 8.8.6 (build 15)
Installation UUID: 0b0b5a6f-a7e1-478a-a330-80ebbe6dc677
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000113

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
	Package version: 612000113

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.102/Sdks
SDK Versions:
	5.0.102
	5.0.101
	5.0.100
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
	3.1.101
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.2
	5.0.1
	5.0.0
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15

=== .NET Core 3.1 SDK ===

SDK: 3.1.405

=== Xamarin.Profiler ===

Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin Designer ===

Version: 16.8.0.510
Hash: 44e3f3ce9
Branch: remotes/origin/d16-8
Build date: 2020-12-10 00:06:14 UTC

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.2.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:04-0500

=== Xamarin.iOS ===

Version: 14.8.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:05-0500

=== Xamarin.Android ===

Version: 11.1.0.26 (Visual Studio Community)
Commit: xamarin-android/d16-8/a36ce73
Android SDK: /Users/puregym/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/puregym/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:34:58 UTC

=== Android Device Manager ===

Version: 16.8.0.46
Hash: 0a81419
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:35:22 UTC

=== Build Information ===

Release ID: 808060015
Git revision: d34d29b4643a130479d762e4d2b5750e6462fde7
Build date: 2021-01-15 08:35:04-05
Build branch: release-8.8
Xamarin extensions: d34d29b4643a130479d762e4d2b5750e6462fde7

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.2.0 Darwin Kernel Version 20.2.0
    Wed Dec  2 20:39:59 PST 2020
    root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

Resource Dictionary Adder 1.0

Build Logs

Screenshots

ios_rtl_bug

Reproduction Link

TestRTL.zip

Workaround

Manually inverse HorizontalTextAlignment on iOS when LineHeight >0 and Device.FlowDirection == FlowDirection.RightToLeft

As I already subclass Label control - then I shadow hide the LineHeight property and inverse the Alignment accordingly. I suspect the same could be done in a Label Renderer.

@IcemarkUK IcemarkUK added s/unverified New report that has yet to be verified t/bug 🐛 labels Jan 28, 2021
@samhouts samhouts added this to New in Triage Jan 28, 2021
@IcemarkUK
Copy link
Author

For further info, the problem appears to be because a label with LineHeight>0 is internally treated like FormattedText on iOS and a AttributedString is created, which then manages to lose the FlowDirection adjusted TextAlignment. This suggests other conditions where the problem would manifest itself.

@IcemarkUK
Copy link
Author

Looks like this has been addressed in later version - didn't find it when searching originally...
#13197

@rachelkang
Copy link
Contributor

@IcemarkUK yes, this issue was fixed in #13197! :)

Triage automation moved this from New to Closed Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
Closed
Development

No branches or pull requests

2 participants