uno icon indicating copy to clipboard operation
uno copied to clipboard

Uno with Wpf Chinese code display messy code

Open ywmoyue opened this issue 3 years ago • 8 comments

Current behavior

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <TextBlock Text="你好,世界!" Margin="20" FontSize="30" /> </Grid>

Expected behavior

image

Environment

Uno.UI / Uno.UI.Skia, Uno.UI.RemoteControl / Uno.WinUI.RemoteControl

Affected platforms

Skia (WPF)

IDE

Visual Studio 2019

IDE version

Microsoft Visual Studio Community 2019 16.11.2 Preview 1.0

Anything else we need to know?

I can set fontfamily for textblock and textbox controls to solve this problem, but setting fontfamily in contentdialog is invalid. image image

ywmoyue avatar Sep 06 '21 04:09 ywmoyue

Affects Gtk as well.

Youssef1313 avatar Sep 06 '21 06:09 Youssef1313

@ywmoyue For ContentDialog, you can customise the TitleTemplate to change the used font.

JaiganeshKumaran avatar Sep 07 '21 04:09 JaiganeshKumaran

@ywmoyue For ContentDialog, you can customise the TitleTemplate to change the used font.

Thanks, I can use this method to solve the problem

ywmoyue avatar Sep 07 '21 13:09 ywmoyue

@jeromelaban Maybe I fix this by https://github.com/mono/SkiaSharp/pull/2146

Could you help me confirm this bug is fixed?

lindexi avatar Jul 07 '22 08:07 lindexi

@lindexi once there's a working build for the SkiaSharp PR, we'll be able to validate if that helps.

jeromelaban avatar Aug 01 '22 13:08 jeromelaban

@jeromelaban Thank you and My PR is merged. Could you help me confirm this bug is fixed?

lindexi avatar Aug 09 '22 00:08 lindexi

@lindexi you'll need to either wait for an official skia build to be released in preview. You can upgrade all SkiaSharp packages in your uno project once those are available.

jeromelaban avatar Aug 09 '22 13:08 jeromelaban

@jeromelaban Can I replace the output file ?

lindexi avatar Aug 09 '22 13:08 lindexi

Looks like this has not been fixed in SkiaSharp 2.88.3 version

lindexi avatar Oct 26 '22 11:10 lindexi

But I test the demo without UNO and I find the demo code work well. Demo code: https://github.com/lindexi/lindexi_gd/tree/0dc53049b7b74e57472408db161d2c066755bace/SkiaSharp/BihuwelcairkiDelalurnere

See https://github.com/mono/SkiaSharp/pull/2146

It seems that UNO still has bugs.

lindexi avatar Oct 26 '22 11:10 lindexi

Uno is not using SKTextBlob to render text, but rather HarfBuzz. How does an Uno app render text with your sample now?

jeromelaban avatar Oct 26 '22 11:10 jeromelaban

@Jaiganeshkumaran Thank you and I just replace the output file.

My demo code: https://github.com/lindexi/lindexi_gd/tree/08c2d7c8da65ffbb1d873a9f4fdb21304a9c2688/TestUnoIslands

lindexi avatar Oct 26 '22 11:10 lindexi

Yes, and I update it.

lindexi avatar Oct 26 '22 11:10 lindexi

Thanks. I see that your app is using an older version of Uno, and it is not updated to the latest version of SkiaSharp. Can you do this and post a screenshot again?

jeromelaban avatar Oct 26 '22 11:10 jeromelaban

@jeromelaban Yes, thank you. I'm worried that my testing method is wrong. Because my test method just replaces SkiaSharp.dll file

lindexi avatar Oct 26 '22 11:10 lindexi

@jeromelaban Sorry, the bug still exists after I updated to 4.5.14 version

My demo code: https://github.com/lindexi/lindexi_gd/tree/4b484190536c301f94ee574f36925155b4a9773c/TestUnoIslands

lindexi avatar Oct 26 '22 11:10 lindexi

Make sure to update SkiaSharp.

jeromelaban avatar Oct 26 '22 12:10 jeromelaban

@jeromelaban Can I add <PackageReference Include="SkiaSharp" Version="2.88.3" /> to update the SkiaSharp?

lindexi avatar Oct 26 '22 12:10 lindexi

Demo Code: https://github.com/lindexi/lindexi_gd/tree/613b6ec4fc7650fba9af341a090b653899d5cb63/TestUnoIslands

Thank you @jeromelaban

It is fixed !

lindexi avatar Oct 26 '22 12:10 lindexi

Uno is not using SKTextBlob to render text, but rather HarfBuzz. How does an Uno app render text with your sample now?

Sorry, I can not get your point at first. And I do not update the SkiaSharp.Harfbuzz at first.

lindexi avatar Oct 26 '22 12:10 lindexi

How to fix it?

  1. Set the Chinese FontFamily to TextBlock
  2. Update the SkiaSharp and SkiaSharp.Harfbuzz package

lindexi avatar Oct 26 '22 12:10 lindexi

Great thanks for the update!

jeromelaban avatar Oct 26 '22 12:10 jeromelaban

This works in Windows without changing the FontFamily. So if this is a requirement currently, then there is still a bug here.

Youssef1313 avatar Oct 26 '22 12:10 Youssef1313

It display messy code without set the Chinese FontFamily.

lindexi avatar Oct 26 '22 12:10 lindexi

@lindexi But it works on UWP/WinUI right? Then I think this is still a bug @jeromelaban .

Youssef1313 avatar Oct 26 '22 12:10 Youssef1313

@Youssef1313 It works well in UWP and WPF without set the FontFamily

lindexi avatar Oct 26 '22 12:10 lindexi

@lindexi whn you say WPF, do you mean an actual WPF app, not a Uno+WPF app? Either way, Skia is using the default system font at this point, and we'll probably fix this by switching to open-sans by default.

jeromelaban avatar Oct 26 '22 12:10 jeromelaban

@jeromelaban I mean the raw WPF application without uno.

lindexi avatar Oct 26 '22 12:10 lindexi

And I think we can set the global font by style. So it doesn't need to be repaired.

lindexi avatar Oct 26 '22 12:10 lindexi