Declined
Last Updated: 31 Jan 2024 06:13 by ADMIN
Legrand
Created on: 22 Dec 2023 15:27
Category: UI for .NET MAUI
Type: Bug Report
1
Icon not displayed when using <WindowsPackageType>None</WindowsPackageType>

When I compile my project with <WindowsPackageType>None</WindowsPackageType> option, icons ar enot displayed in Telerik controls (like richeditor)

Same project compiled with package  and deployed are ok

 

 

 

 

11 comments
ADMIN
Didi
Posted on: 31 Jan 2024 06:13

Hi Paul,

This is the link to the article: https://docs.telerik.com/devtools/maui/knowledge-base/troubleshooting-missing-fonts-unpackaged-deployment 

and the link to the GitHub repo: https://github.com/telerik/maui-docs/blob/master/knowledge-base/troubleshooting-missing-fonts-unpackaged-deployment.md 

 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Paul
Posted on: 31 Jan 2024 00:10
I have an unpackaged maui app too.

The link https://github.com/telerik/maui-docs/blob/font-kb-patch/knowledge-base/troubleshooting-missing-fonts-unpackaged-deployment.md is giving me

404 - page not found
Cannot find a valid ref in 

font-kb-patch/knowledge-base/troubleshooting-missing-fonts-unpackaged-deployment.md


Legrand
Posted on: 10 Jan 2024 14:28

Your project is ok on my PC, icons are displayed well.

 

I will check my own project again .

ADMIN
Petar Marchev
Posted on: 10 Jan 2024 11:17

Hi,

I actually cannot reproduce this. I tested on two PCs and in both cases, the DataGrid was displayed properly with the symbols in mind.

Please check attached image:

 

Check the attached zip file - it is basically the same project you sent, but I added the RadDataGrid and removed the AppendMapping for the FontFamily, because MS have fixed the issue this work-around is no longer needed:

//Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping("FontFamily", (handler, element) =>

 

Please test the project on your side and let us know how it goes.

Regards,
Petar Marchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files:
Legrand
Posted on: 03 Jan 2024 15:08

By the way, I have the same issue with DataGrid

 

ADMIN
Petar Marchev
Posted on: 28 Dec 2023 15:29

Hello Legrand,

As I mentioned in my earlier reply, I have logged the issues I discussed.

Here you can find a link to the Telerik feedback portal. Here you can track the status of the item. I have also updated your Telerik points as a thank you for letting us know of this issue.

Also, here is a link to the respective ms issue. Don't forget to cast your vote there too, and even reply to the issue there, mentioning that it affects you too, as MS count votes and replies when prioritizing issues.

Regards,
Petar Marchev
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com
ADMIN
Petar Marchev
Posted on: 28 Dec 2023 11:37

Hi,

I am no expert on fonts, but I think you can search to find which fonts are available in WinUI out of the box. Perhaps start with the most famous fonts like Arial, Calibri, Segoe UI (start here). You can see if you can find icons built-in the fonts to see if you can make it work.

And just to make sure you haven't missed it - you can also use images.

Regards,
Petar Marchev
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com
Legrand
Posted on: 27 Dec 2023 09:47

I can reproduce the same problem with Image.

 

About the Workaround, we need to use unpackaged maui app.

 

I tried :   <FontImageSource Glyph="&#x2776;" FontFamily="Segoe UI" /> this is not ok

                <FontImageSource Glyph="&#x2776; /> this is ok ! (I have the right char from Segoe UI font)

 

But it's not working with telerikfont or telerikcontrolsicons

I don't understand the difference, Is there a build in font I can use for the richtexttoolbar ?

 

Regards

Bruno Legrand

ADMIN
Petar Marchev
Posted on: 26 Dec 2023 16:49

Hi Legrand,

Thank you for attaching a repro project and clarifying which controls you are using.

 

A quick note

First, I would like to say that while digging into this I found out that MS have done a fix for the original issue that Lance mentioned. So at this point you should not need to intercept the mapping for the font family (LabelHandler.Mapper.AppendToMapping("FontFamily"...). In the future we will be incorporating fonts.AddFont("TelerikFont.ttf", "telerikfont"); in our code so you will not need to set it as well (but will have to keep it for now).

 

The toolbar items issue

I was able to reproduce the issue at hand - the toolbar items do not show a proper text. Indeed this is different from the other text that do get properly displayed with Lance's fix.

I looked into this and it turns out that the fix handles Label instances. But in the toolbar we are using Image and a FontImageSource. So the Rad toolbar items do not benefit from the improved font family mapping.

Very unfortunately, just as the original issue, this issue is again not on our side, but somewhere in the framework. I was able to reproduce the issue at hand outside of the Telerik controls, in a simple Image element:

<Image x:Name="i3" WidthRequest="100" HeightRequest="100" Background="#33EE22AA">
  <Image.Source>
    <FontImageSource Glyph="&#xe85b;" FontFamily="telerikfontexamples" />
  </Image.Source>
</Image>

You can run this code on your side to confirm that the glyph is not rendered. So again, we have to log an issue in the maui repo and wait for a fix.

 

Trying to overcome the issue

I tried but could not find a work-around for this. Similarly to the original work-around, I tried intercepting the mapping for the Source property of the image, but I could not properly create a native WinUI image source. I tried using the CanvasImageSource as maui use it in their repo, but could not create an instance, as some argument out of range exceptions were thrown and I could not figure out why. Perhaps you can give it a go and manage to get it working.

As it is towards the end of the day here, I will not be able to log an issue in the maui repo today, but I will do that until the end of the week and send you the link so that you can also vote there.

 

Work-around

At the moment I can only think of two ways to go here.

1. One way to avoid this is to not use an unpackaged WinUI app.

2. Another option is to manually set the ImageSource property for each toolbar item you have:

<telerik:RadRichTextEditorToolbar AutoGenerateItems="False">
  <telerik:ButtonToolbarItem>
    <telerik:ButtonToolbarItem.ImageSource>
      <FileImageSource>available.png</FileImageSource>

Here, the available is a regular maui image (png or svg), added to the Resources/Images folder. Actually you can use a FontImageSource as well:

<telerik:ButtonToolbarItem.ImageSource>
  <FontImageSource Glyph="&#x2776;" FontFamily="Segoe UI" />

In my tests, the maui Image only struggles with custom fonts, so if you were to use some of the built-in fonts then the toolbar items could get properly displayed.

While this work-around sounds like it is a lot of work - it will get you going, where if we have to wait for a fix from MS for a bug that only happens for unpackaged WinUI apps and a custom font, only for the FontImageSoure - I think we will have to wait for a long long time.

I will follow you up until the end of the week with link to the issue I will log for this. Let us know if you have any other questions about this at the moment.

Regards,
Petar Marchev
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com


Legrand
Posted on: 26 Dec 2023 09:25

Hello Lance,

 

I tried your example with no change and it's ok.

 

But when I had a telerik:RadRichTextEditorToolbar in the mainpage, icons are not displayed

 

ADMIN
Lance | Senior Manager Technical Support
Posted on: 22 Dec 2023 16:18

Hello Legrand,

This is because of a Font bug in the Windows app SDK, rather than anything in .NET MAUI or Telerik UI for Maui.

The reason is because an unpackaged app doesn't have an ms-appx://Assets/Fonts path, where the font files are when it is packaged. So the path to that does not exist, and thus the .NET MAUI FontManager cannot load it.

There is a workaround that I can share with you, see the attached project and my description in the following KB => maui-docs/knowledge-base/troubleshooting-missing-fonts-unpackaged-deployment.md.

I have attached the app I built while writing the workaround. Open MauiProgram.cs and observe the workaround steps:

  • Add the font file to your .NET MAUI project and register the fonts in MauiProgram.cs
  • Set the font file's Build Action to Copy Always (or Copy if Newer)
  • Use an #ifdef block for Windows and update the Windows platform handler's paths in MauiProgram.cs

Now, when you run the app, you will see the "four fonts" test on MainPage.xaml render correctly:

Ultimately, we have no control over this unpackaged side effect. However, with just a few minutes of work on your side, you can ensure unpackaged deployments still have access to the font files.

Regards,
Lance | Manager Technical Support
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com

[edit] Removed closing statement because this is a Feedback Portal item.

Attached Files: