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

Custom Font in Forms Labs ExtendedLabel

$
0
0

I'm trying to use ExtendedLabel to set a custom font in code, but all I get is the default System Font. Here's what I have, pretty straightforward:

        `var myLabel = new ExtendedLabel
        {
            Text = "some text",
            FontSize = 60, 
            HorizontalOptions = LayoutOptions.StartAndExpand,
            VerticalOptions = LayoutOptions.Center,
            TextColor = Color.Pink,
            FontName = "OpenSans.ttf"
        };`

I've tried putting the font file (OpenSans.ttf) in my Android project under /Assets and /Assets/fonts. I've tried referencing it with no path, as well as both of those paths. The font file build action property is set to Android Asset. Also, the FontSize property doesn't seem to work on Windows Phone. Is there anything else I should try?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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