unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.09k stars 739 forks source link

TextBlock trimming not working properly on Android and iOS #1313

Open abrull opened 5 years ago

abrull commented 5 years ago

Current behavior

When using TextTrimming="WordEllipsis" words get broken up

Expected behavior

The trimming should happen between words not breaking up words

How to reproduce it (as minimally and precisely as possible)

<TextBlock Text="Hello world!" 
                   Width="65"
                   MaxLines="1"
                   TextTrimming="WordEllipsis"/>

Environment

Nuget Package: Uno.UI

Package Version(s): 3.0.12 Affected platform(s):

Visual Studio

Relevant plugins

Anything else we need to know?

ghuntley commented 5 years ago

Howdy @abrull. I can't seem to reproduce this with 1.46.0-dev.2340. Do you have a screenshot?

Android:

image

UWP:

image

<Page
    x:Class="App5.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App5"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" Padding="48">

  <Grid Background="Black">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"/>
      <ColumnDefinition Width="60"/>
      <ColumnDefinition Width="120"/>
      <ColumnDefinition Width="240"/>
      <ColumnDefinition Width="3*"/>
      <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <TextBlock Grid.Column="0"
               Foreground="Red"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

    <TextBlock Grid.Column="1"
               Foreground="Orange"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

    <TextBlock Grid.Column="2"
               Foreground="Yellow"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

    <TextBlock Grid.Column="3"
               Foreground="Green"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

    <TextBlock Grid.Column="4"
               Foreground="Blue"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

    <TextBlock Grid.Column="5"
               Foreground="Violet"
               Text="Extra long text"
               MaxLines="1"
               TextTrimming="WordEllipsis"
               TextWrapping="WrapWholeWords"/>

  </Grid>
</Page>
abrull commented 5 years ago

@ghuntley Hey, I reproduced the issue with version 1.46.0-dev.2340. Here is a screenshot..

image

MatFillion commented 4 years ago

The sample has MaxLines="1" so I don't think there's any wrapping involved. The property that comes into play is TextTrimming, Enum is WordEllipsis, CharacterEllipsis or None. Or an issue with textmeasurement in some devices or fonts. Is this issue only occuring with the last character? Is is possible to get it to display "lo..." instead of "lon..." ?

abrull commented 4 years ago

@MatFillion Sorry about that. Yeah the issue is with TextTrimming with WordEllipses and yes, it's possible to get it to break at any letter of the work given the width of the TextBlock. I updated the title and details of the issue and the version of Uno.UI that I used

agneszitte commented 4 years ago

@MatFillion also here is another issue related to MaxLines with a fixed Width => https://github.com/unoplatform/uno/issues/3714

sasakrsmanovic commented 3 years ago

Hello @abrull . I heard from your team that this issue may no longer be needed. Could you please confirm, and if so, close the issue please. Thanks in advance.

abrull commented 3 years ago

@sasakrsmanovic This issue is no longer blocking us. I'm not saying that the issue resolved. Should I leave it open so it gets addressed in the future?

Youssef1313 commented 3 years ago

I took a look and it seems this is not natively supported in Android and iOS.

Zerachiel01 commented 5 months ago

Issue still exists in 2024. Will this be addressed in any way? Or is there a way to warn users, that the property will not work on ios and android or something like that?