Skip to content
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

Font Alias is not working #13805

Closed
RobertoGFilho opened this issue Mar 9, 2023 · 5 comments
Closed

Font Alias is not working #13805

RobertoGFilho opened this issue Mar 9, 2023 · 5 comments
Labels
area-fonts Custom fonts and Font related API's platform/windows 🪟 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working

Comments

@RobertoGFilho
Copy link

RobertoGFilho commented Mar 9, 2023

Description

I have added icon font on my projet, last MAUI version, Alias Font stopped to work see:

        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseSkiaSharp(true)
                .UseMauiApp<App>()
                .UseMauiCommunityToolkit()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("Roboto-Regular.ttf", "RobotoRegular");
                    fonts.AddFont("Roboto-Bold.ttf", "RobotoBold");

                    **fonts.AddFont("MaterialIconsOutlined-Regular.otf", "MaterialIconsOutlined");**
                });
         }

DOESN'T WORK

        <Image
            HeightRequest="100"
            BackgroundColor="#D1D1D1">
            <Image.Source>
                <FontImageSource
                    Glyph="&#xE029;"
                    **FontFamily="MaterialIconsOutlined"**
                    Size="44" />
            </Image.Source>
        </Image>

WORKS

        <Image
            HeightRequest="100"
            BackgroundColor="#D1D1D1">
            <Image.Source>
                <FontImageSource
                    Glyph="&#xE029;"
                    **FontFamily="Material Icons Outlined"**
                    Size="44" />
            </Image.Source>
        </Image>

Steps to Reproduce

  1. New MAUI Project;
  2. Add Icon Font

Link to public reproduction project repository

https://github.com/RobertoGFilho/MauiSamples

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows SDK 10.0.17763.0

Did you find any workaround?

No response

Relevant log output

No response

@RobertoGFilho RobertoGFilho added the t/bug Something isn't working label Mar 9, 2023
@danardelean
Copy link

It works on my side. Look at the attached modified sample (it is the one I took from your repository)

Hope it helps!

https://1drv.ms/u/s!AuJWJQUKZPJosNFecufxja3LJMwMKA?e=gUVxb2

Regards,
Dan

@Eilon Eilon added the area-fonts Custom fonts and Font related API's label Mar 10, 2023
@mattleibow
Copy link
Member

@danardelean what did you have to chnge to make it work?

@vautieri2
Copy link

vautieri2 commented Jun 14, 2023

I'm finding issues with this as well. My #else condition is MS Windows (below). What I have below has font working for a computer that has Visual Studio Enterprise we are compiling on and Android, but not for our Visual Studio Professional system building where only fonts work for Android Systems. Our IDEs have all been updated to the latest version as of 6/13. I just started looking into this yesterday, so I have no idea if the IDEs are why it's working/not working. Just adding a datapoint in case it helps narrow things down.

MaterialDesignIcons.FontFamily = "MaterialDesignIcons"

public const string Airplane = "\U000f001d";

#if ANDROID
fonts.AddFont(filename: "materialdesignicons-webfont.ttf", alias: MaterialDesignIcons.FontFamily);
#else
fonts.AddFont(filename: "materialdesignicons-webfont-Regular.ttf", alias: MaterialDesignIcons.FontFamily);
#endif

        <Button Opacity="1.0" FontSize="22" HorizontalOptions="Center" VerticalOptions="Center" FontFamily="MaterialDesignIcons"
            BackgroundColor="#332C3240" TextColor="Yellow"
            Text="{x:Static helpers:MaterialDesignIcons.Airport}"> 
        </Button>

@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Jun 21, 2023
@ghost
Copy link

ghost commented Jun 21, 2023

Hi @RobertoGFilho. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

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.

@Zhanglirong-Winnie
Copy link
Collaborator

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Not repro on windows platform with sample project.
MauiSamples-master (1).zip

@ghost ghost closed this as completed Jun 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 28, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-fonts Custom fonts and Font related API's platform/windows 🪟 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants