2

I'm using ArcGIS Runtime in Xamarin Forms.

I want to display icons on the map using an icon font.

I'm using the same icon font - Material Design Icons - throughout the rest of my app successfully.

I have tried lots of ways to specify the font name and none work.

Here is how I use the font elsewhere via app.xaml

<OnPlatform x:Key="MaterialFontFamily" x:TypeArguments="x:String">
    <On Platform="iOS" Value="Material Design Icons" />
    <On Platform="Android" Value="materialdesignicons-webfont.ttf#Material Design Icons" />
    <On Platform="UWP" Value="Assets/materialdesignicons-webfont.ttf#Material Design Icons" />
</OnPlatform>

I'm testing on UWP so I started out trying to get a map pin to display on that.

Here is my code:

public static TextSymbol GetJobSymbol(string jobStatusColourHex)
{
    var color = ColorConverters.FromHex(jobStatusColourHex);
    var symbol = new TextSymbol()
    {
        Text = IconFont.MapMarker,
        Color = color,
        Size = 30,
        FontFamily = "Assets/materialdesignicons-webfont.ttf#Material Design Icons"
    };
    return symbol;
}

I'm using a mapping file for the icon codes - IconFont.MapMarker equates to "\uf34e"

I tried the following combinations of font name, sub-name and location:

Assets/materialdesignicons-webfont.ttf#Material Design Icons
Assets/materialdesignicons-webfont.ttf
Assets/materialdesignicons-webfont
materialdesignicons-webfont.ttf#Material Design Icons
materialdesignicons-webfont.ttf
materialdesignicons-webfont

This is what I get each time:

enter image description here

Any ideas?

Steve Chadbourne
  • 6,873
  • 3
  • 54
  • 82
  • Have you found any solution? The docs doesn't mention anything about font family on Xamarin Forms and nothing works on my machine. – NearHuscarl Jul 31 '21 at 15:59
  • 1
    @NearHuscarl We had to perform a convoluted workaround. I asked our developer to add a reply with more details but it involved using Skiasharp, load svg then convert to a png, then using PictureMakerSymbol to load png as point symbol. – Steve Chadbourne Aug 01 '21 at 21:55

0 Answers0