maui icon indicating copy to clipboard operation
maui copied to clipboard

Font Alias is not working

Open RobertoGFilho opened this issue 1 year ago • 1 comments

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="" 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 avatar Mar 09 '23 21:03 RobertoGFilho

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

danardelean avatar Mar 10 '23 07:03 danardelean

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

mattleibow avatar Mar 13 '23 20:03 mattleibow

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>

vautieri2 avatar Jun 14 '23 15:06 vautieri2

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.

ghost avatar Jun 21 '23 07:06 ghost

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

Zhanglirong-Winnie avatar Jun 21 '23 07:06 Zhanglirong-Winnie