-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FontFamily is not recognized in Unpackaged application in net 8 #19061
Comments
Did you have a different font to the old issue? Or is that sample not working still? |
Hi @danies8. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
It is not working. |
In additions the controls not lóok good in unpackaged deployment. |
You also have comments here: microsoft/microsoft-ui-xaml#7866 The comments from brad says: "This app is not MAUI but it is WinUI3." |
Maybe a dupe of #15802 ? |
Hmmm, could be. @danies8 are you using fonts on Label/Button or are using FontImageSource on Image/ImageButton? |
@danies8 I did some tests now on my new Windows Server 2019 VS (with Desktop Experience) and I am not able to repro the dropdowns missing arrows and other text not rendering. I was able to repro #15802 with FontImageSource not working. This was my publish command:
|
Unless those are all Telerik controls? I think I need to see a repro at this point as I am not sure of exactly what you have. |
Hi @danies8. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @danies8. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
I used : |
Please see : https://app.screencast.com/H2vDCa2jmYxCf |
I also asked from Manager support of TELERIK (Lance) to answer here. |
Hi Daniel, I don't see how this is solely related to the Telerik UI for Maui components, as the problem is presented in a normal Maui Let's take a step back and align on some ideas before digging deeper:
That seems like you have a couple steps to do so that when your app is running unpackaged, you need to address this use case. Here are the fonts we use: If you have the demos installed locally, you will find them here: If you open the font file, you will find all the information you need to register them separately (font family name, etc). You did share a code snippet with me, all I can say about that is it is incorrect and looks like you copy/pasted a FontAwesome example without updating it to match the font file's actual FontFamilyName? Some challenges for you:
Continued AssistanceSince this issue is flagged with needs-info/needs-repo, you will need to do the following:
If the problem still exists, you can share the reproducible project with me and Matthew for further investigation. Tips:
Side Note@mattleibow Telerik UI for Maui uses the telerikcontrolsicons.ttf as the source of icons throughout the controls. This usually doesn't require that the developer also include the fonts file in their project. I think this is the genesis of Daniel's motive ot open this Issue. Although this time it affects RadButton for example, but it should affect any 3rd party library that has font assets in it (or anything that points to the appx package URI). I haven't dug into the WinUI threads on this topic, but I'm guessing when published unpackacked, the file paths to the package are incorrect? |
As a side thought, @danies8 what happens if you actually install the missing fonts into Windows Server 2019 instead of relying on the app to use in-package assets? This could be a temporary workaround until the fundamental issue is resolved.
|
Hi, |
Did you try building a couple times, or did you immediately post here after getting the error once? The reaosn I ask is the Resizitizer is a process that creates the correct assets for each platform (e.g. MauiIcon files). This happens in a background thread and can lock the files it is working with. Sometimes, if you try to build too fast, or there's a different order of operations, you can encounter issues. Just Clean and Rebuild the app again, try it a couple times until it works. Be patient between attempts, or even close and restart Visual Studio if the lock isn't going away. |
Daniel, I've reviewed the project and it is not what we asked for. You did not complete the process if registering the fonts and there is nothing in MainPage that attempts to use the font. Please do the following:
Once you've confirmed the behavior, get a screenshot, then come back here with the project and the evidence of the behavior. [edit] Remove unnecessary narrative comment |
Hi Matthew, 1.Here is the repro project, you can use the following command to build it unpackaged Let me know if you need anything else. Thank you for your time and effort, Dani |
Just want to note that the sample did not compile because the Once it ran, the same text appeared:
I believe this is because you have invalid XAML: <Label Text="&#xe85b;" ... /> This should be (note the <Label Text="" ... /> The reason for the first label being incorrect is a spelling error in the font name. It is registered as fonts.AddFont("telerikcontrolsicons.ttf", "telerikcontrolsicons"); <Label Text=""
FontFamily="telerikcontrolsicons" /> I have attached my sample: |
Hi @danies8. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @danies8. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@mattleibow thank you for helping Daniel with the unrelated clean up. Were you able to check if this works in unpackaged on Windows Server 2019? I'm still trying to get Azure to spin up a new one for me. I have an idea, that if the unpackaged app isn't including font files which are embedded in the external assemblies, Daniel can workaround this by including the font file in his project code, registering them in MauiProgram and using CopyAlways as the Build Action (looking at the workaround for microsoft-ui-xaml/issues/7866, I feel that should also work here, too). |
@danies8 That's great news! As you go to implement this on your real app, don't forget there are two parts to the solution:
I don't know if you still need to use the handler, but just in case, this is the full code from MauiProgram.cs: public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("telerikcontrolsicons.ttf", "telerikcontrolsicons");
fonts.AddFont("telerikfontexamples.ttf", "telerikfontexamples");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
#if WINDOWS
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping("FontFamily", (handler, element) =>
{
if (element.Font.Family == "telerikcontrolsicons")
{
const string FontTelerikControlsIconsFamily = "telerikcontrolsicons.ttf#telerikcontrolsicons";
handler.PlatformView.FontFamily = new Microsoft.UI.Xaml.Media.FontFamily(FontTelerikControlsIconsFamily);
}
if (element.Font.Family == "telerikfontexamples")
{
const string FontTelerikControlsIconsFamily = "telerikfontexamples.ttf#telerikfontexamples";
handler.PlatformView.FontFamily = new Microsoft.UI.Xaml.Media.FontFamily(FontTelerikControlsIconsFamily);
}
});
#endif
return builder.Build();
}
} |
Awesome! Windows Server is cool again! Can we close this issue as all fixed? |
I didn't test it, does we need the handler as Lance |
@mattleibow yeah, it's confirmed working, so I would consider this closed. @danies8 you have a 50/50 chance, it either works with it or not... but you know it's working with one of them 😁 |
Tomorrow morning I will check if handler is needed or not and let you know on both machines: |
I removed the handler and the code work as expected using vs. |
Description
This link not solved in NET 8.
[WinUI] FontFamily is not recognized in Unpackaged application
#9104
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: