Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Problem with custom fonts in XAML for Android

$
0
0

I'm having trouble getting a custom font working in XAML on Android. I've narrowed it down using the Working With Fonts demo. In the FontPageXaml.xaml file, I've made the following changes (edited for brevity):

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:WorkingWithFonts;assembly=WorkingWithFonts"
             x:Class="WorkingWithFonts.FontPageXaml">
    <StackLayout 
            VerticalOptions = "CenterAndExpand" 
            HorizontalOptions="CenterAndExpand">
        <local:MyLabel Text="Hello Forms with XAML">
            <Label.Font>
                <OnPlatform x:TypeArguments="Font">
                    <OnPlatform.iOS>MarkerFelt-Thin,Medium</OnPlatform.iOS>
                    <OnPlatform.Android>Large</OnPlatform.Android>
                    <OnPlatform.WinPhone>Bold,Medium</OnPlatform.WinPhone>
                </OnPlatform>
            </Label.Font>
        </local:MyLabel>
            <local:MyLabel Text="Biggest NamedSize" Font="Large" />
        <local:MyLabel Text="Use size 72" Font="Italic,72" />
    </StackLayout>
</ContentPage>

I can breakpoint the custom renderer, and it's getting hit for each of the custom labels, but the font is not being applied. The font continues to work fine on the "C#" tab fine, just not in Xaml. Am I doing something wrong, have I hit a new bug, or is there a known issue that isn't well documented?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>