microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.27k stars 674 forks source link

TextBox: Wrong font stretch when setting font family #808

Open ceee opened 5 years ago

ceee commented 5 years ago

Describe the bug When you set a font family via FontFamily in a TextBox it may use the wrong font stretch by default, in case the font family contains multiple stretches. This is the case for Arial, Bahnschrift and others. There is no way to select a different font stretch in a TextBox as the FontStretch property seems to be completely ignored. The same problem also exists for the RichEditBox.

Steps to reproduce the bug

  1. Create a new UWP project
  2. Add this XAML into the MainPage.xaml
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
    <TextBlock Text="Arial" FontFamily="Arial" FontSize="32" />
    <TextBox Text="Arial" FontFamily="Arial" FontSize="32" FontStretch="Normal" Margin="0 20 0 0" Width="300" />
    </StackPanel>

Expected behavior It is expected that the rendered text from the TextBlock looks the same as from the TextBox. Instead Arial Narrow is used and the FontStretch property is completely ignored.

Screenshots image

Version Info OS: Win10 Pro x64 (17763) SDK: Reproduced this with 17763, 17134, 16299 and 15063.

ceee commented 5 years ago

Any updates on this?

ceee commented 5 years ago

Ping ping... @chrisglein

marcelwgn commented 4 years ago

I think this is something we can only fix with WinUI 3.0 since settting the font stretch on the content presenting ScrollViewer has no effect, and changing the content presenting ScrollViewer to a ContentPresenter and setting thats FontStretch does not work either.

chrisglein commented 4 years ago

Confirmed. Neither TextBox.FontStretch or RichEditBox.FontStretch are not setting this with RichEdit. This is a bug, and to fix it we'd need to do it in WinUI 3.0. For RichEditBox as a workaround the app can set it in code through the document API on CharacterFormat using the ITextCharacterFormat API.

ceee commented 4 years ago

Still broken in WinUI 3.0 Preview 2, @chrisglein @chingucoding @jevansaks

image

DierkDroth commented 2 years ago

Still broken after releasing WindowsAppSdk. Confirmed with TextBox/TextBlock + Roboto font.

ceee commented 2 years ago

Almost 3 years later and this is still ignored 😔 @chrisglein As this was not part of WinUI 3, when and where can we expect a fix for this issue?

ceee commented 2 years ago

@jevansaks @chrisglein Any updates on this issue?

AndrewKeepCoding commented 2 years ago

I'd really appreciate if this get fixed soon.😢

ceee commented 1 year ago

@jevansaks @chrisglein Any updates on this issue?

JohnnyWestlake commented 4 months ago

Bumping this; I also don't understand why you would need WinUI 3 to fix it. It's an internal platform issue...