-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
MauiFont
not usable if added in MauiLibrary
#21771
Comments
Can repro this issue at Windows platform on the latest 17.10 Preview 3(8.0.10&8.0.14&8.0.20). |
Duplicate of #19804 |
Thought we had to use this #10019 (comment) (demo repo https://github.com/awalker-dsg/MauiTestLib_10019/tree/add_targets_file/MauiTestLib_10019) for sharing resources between projects. This does work for svg files but sadly the FontImageSource for unpacked apps doesn't work with version 8.0.20. |
@GuidoNeele I created the file <Project>
<!-- https://github.com/dotnet/maui/issues/10019#issuecomment-1248032520 -->
<ItemGroup>
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\FluentFontIcons.ttf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\FontAwesome5Brands.otf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\FontAwesome5Solid.otf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\materialdesignicons-webfont.ttf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\Montserrat-Bold.ttf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\Montserrat-Medium.ttf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\Montserrat-Regular.ttf" />
<MauiFont Include="$(MSBuildThisFileDirectory)\Fonts\Montserrat-SemiBold.ttf" />
</ItemGroup>
</Project> In the <!-- Workaround: https://github.com/dotnet/maui/issues/10019#issuecomment-1248032520 -->
<ItemGroup>
<None Include="..\..\SharedMauiXamlStylesLibrary.targets" Pack="True" PackagePath="buildTransitive\" />
</ItemGroup>
<ItemGroup>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />-->
<!-- Workaround: https://github.com/dotnet/maui/issues/10019#issuecomment-1248032520 -->
<None Include="Resources\Fonts\FluentFontIcons.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\FontAwesome5Brands.otf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\FontAwesome5Regular.otf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\FontAwesome5Solid.otf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\materialdesignicons-webfont.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\Montserrat-Bold.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\Montserrat-Medium.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\Montserrat-Regular.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
<None Include="Resources\Fonts\Montserrat-SemiBold.ttf" Pack="True" PackagePath="buildTransitive\Fonts\" />
</ItemGroup> This seems to fix the issue as well as for svg files. |
Duplicate of #19804 |
Description
I have a shared maui style library which contains some custom fonts. Those fonts are registered as
MauiFont
resources in the library.The library is added as nuget to a
MauiApp
project.Library
The font is added via a
AppHostBuilderExtension
In the project file of the library, the fonts are all added as
MauiFont
App
The nuget
MauiLib
is installed to theMauiApp
.In the
MauiProgram.cs
, the fonts are registered.Console output is as following:
If I start the
MauiApp
, I'll get this exception.If I'm adding just a reference to the
MauiLib
, instead of installing the nuget, it starts to work.MauiApp
So it seems that the font gets missing or moved when packaged as
Nuget
Maybe this is relevant to:
#10112
Steps to Reproduce
Windows
MauiApp
project file and disable the nuget and enable the library referenceLink to public reproduction project repository
https://github.com/AndreasReitberger/MauiFontsIssueLibrary
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
No response
Did you find any workaround?
Also add the
MauiFont
file to theMauiApp
project.Relevant log output
No response
The text was updated successfully, but these errors were encountered: