microsoft / Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.
http://microsoft.github.io/Win2D
Other
1.78k stars 284 forks source link

CanvasTextFormat throws in Unpackaged apps #941

Open mattleibow opened 7 months ago

mattleibow commented 7 months ago

This is very similar to https://github.com/microsoft/Win2D/issues/891

But instead of the CanvasFontSet API, I am trying to render an image using text with the CanvasTextFormat type. This thows a similar exception:

The URI specified in the CanvasTextFormat's FontFamily has an invalid scheme; the scheme may be omitted, or must be one of ms-appx:// or ms-appdata://.

This is our code: https://github.com/dotnet/maui/blob/d8939fdfc48fb36d18a3bb6d9cafb1c09c19117b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs#L55-L95

We are basically rendering a character onto a canvas using some font properties. Fonts work fine in packaged and when I do unpackaged I get an exception.

I also tried a full path using the file:// and that does not crash, but it renders the placeholder/missing empty rectangle.

mattleibow commented 7 months ago

This issue came up in our case of rendering text to a bitmap: https://github.com/dotnet/maui/issues/15802

AathifMahir commented 5 months ago

Facing the same issue here as well: https://github.com/AathifMahir/MauiIcons/issues/79

BurkusCat commented 5 months ago

I have a .NET MAUI app where this issue is causing button icons to break in the unpackaged WinUI version of the app. There doesn't appear to be any workarounds with handlers which is disappointing. The only workaround would be to not use font icons at all and use .svgs which I'm hesitant to do specifically for WinUI unpackaged only.

Would it be possible to have a fix for this issue prioritised, please?

jeremy-visionaid commented 5 months ago

Agreed. this should be a priority issue for Win2D as it is a blocker for other downstream issues.

AndreasReitberger commented 5 months ago

Facing the same issue. Is there an ETA for this fix from Microsoft?

@mattleibow thanks for open this issue 😊

jingliancui commented 5 months ago

Hi team, I met the same issue on Maui, it impacted the unpacked program. Do you have any workaround or fixing plan on this. Thanks so much in advance.

AndreasReitberger commented 4 months ago

The issue at the MAUI repository has been closed now. Is the fix from Win2D already read? @mattleibow

Thank you!

SF3969 commented 2 months ago

Is there any update on this?

SF3969 commented 1 month ago

Any update on this issue?

AndreasReitberger commented 1 month ago

@mattleibow Any chances that this is checked by Microsoft soon? Thank you!

mattleibow commented 1 month ago

Has anyone tried the latest Win2D? All the Maui use cases are now working in 1.2.0

jeremy-visionaid commented 1 month ago

It works OK for me since 1.2.0 and I don't see any newer versions

AndreasReitberger commented 1 month ago

@SF3969 Can you verify the fix? It seems that only Syncfusion controls have this issue now. Maybe an update of the dependencies is needed here as well.

@mattleibow Thank you!

AathifMahir commented 1 month ago

Has anyone tried the latest Win2D? All the Maui use cases are now working in 1.2.0

When can we expect Maui Side to update the Win2D Dependency to v1.2.0? Next Service Release?

jingliancui commented 1 month ago

Has anyone tried the latest Win2D? All the Maui use cases are now working in 1.2.0

When can we expect Maui Side to update the Win2D Dependency to v1.2.0? Next Service Release?

Maybe it is better to raise an issue on maui repo

mattleibow commented 1 month ago

@AathifMahir what version are you using because this has been fixed for months. Since 8.0.10.

AathifMahir commented 1 month ago

@AathifMahir what version are you using because this has been fixed for months. Since 8.0.10.

This is regarding below issue, more users keeps reporting on this, when it comes v8.0.10 I don't think that fixes the issue

https://github.com/AathifMahir/MauiIcons/issues/79