Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always distribute specified line height evenly #15481

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Apr 23, 2024

What does the pull request do?

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        x:Class="Sandbox.MainWindow">
  <Window.Resources>
    <ControlTheme x:Key="WithLineHeightExample" TargetType="TextBlock" >
      <Setter Property="FontWeight" Value="SemiBold" />
      <Setter Property="FontSize" Value="18" />
      <Setter Property="LineHeight" Value="50" />
    </ControlTheme>

    <ControlTheme x:Key="WithoutLineHeightExample" TargetType="TextBlock">
      <Setter Property="FontWeight" Value="SemiBold" />
      <Setter Property="FontSize" Value="18" />
      <Setter Property="LineHeight" Value="NaN" />
    </ControlTheme>

    <ControlTheme x:Key="WithNegativeLineHeightExample" TargetType="TextBlock">
      <Setter Property="FontWeight" Value="SemiBold" />
      <Setter Property="FontSize" Value="18" />
      <Setter Property="LineHeight" Value="18"/>
    </ControlTheme>
  </Window.Resources>

  <Border Padding="20">
    <StackPanel Spacing="10">
      <Border BorderThickness="1" BorderBrush="Black" Padding="0" Margin="10">
        <TextBlock Theme="{StaticResource WithLineHeightExample}"
                   Text="The quick brown fox jumps over the lazy dog (LH=50)" />
      </Border>
      <Border BorderThickness="1" BorderBrush="Black" Padding="0" Margin="10">
        <TextBlock Theme="{StaticResource WithoutLineHeightExample}"
                   Text="The quick brown fox jumps over the lazy dog (LH=NaN)" />
      </Border>
      <Border BorderThickness="1" BorderBrush="Black" Padding="0" Margin="10">
        <TextBlock Theme="{StaticResource WithNegativeLineHeightExample}"
                   Text="The quick brown fox jumps over the lazy dog (LN=18)" />
      </Border>
    </StackPanel>
  </Border>
</Window>

Screenshot 2024-04-23 170633

What is the current behavior?

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes: #13873

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047600-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 merged commit 2e514d7 into AvaloniaUI:master Apr 25, 2024
10 checks passed
@maxkatz6 maxkatz6 added area-textprocessing backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Apr 25, 2024
@halgari
Copy link
Contributor

halgari commented Apr 25, 2024

This is awesome! Thanks!

@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Apr 25, 2024
@Gillibald Gillibald deleted the fixes/lineHeightDistribution branch April 25, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text aligned to top instead of center when changing LineHeight on TextBlock.
4 participants