Custom font Xamarin.Android

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Thomas
Newbie
Newbie
Posts: 15
Joined: Thu Mar 21, 2013 12:00 am

Custom font Xamarin.Android

Post by Thomas » Fri Jan 24, 2014 9:33 am

Hi!
I use Xamarin.Android and Xamarin.iOs.
I need to dispaly chart data with Calibri font.
On iOs when i set g.Font.Name = "Calibri" everything is ok. But on android it does nothing. The font isn't changing.
I tried to load custom font from .ttf file

Code: Select all

var textPaint = new TextPaint ();
textPaint.SetTypeface (Singleton.Instance.Calibri);
var chartFont = new ChartFont (textPaint);
g.Font = chartFont;
It works, but on nexus 7 letters look not good. They aren't sharp and look blurred.

How to use calibri font on android?
Need i licence to use calibri, or it is free, either it is licenced by teechart?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Custom font Xamarin.Android

Post by Narcís » Fri Jan 24, 2014 11:58 am

Hi Thomas,
Thomas wrote: On iOs when i set g.Font.Name = "Calibri" everything is ok. But on android it does nothing. The font isn't changing.
I have checked that the code below works fine, as explained here. Although, as you said, fonts are not being rendered very smoothly. So I have added the issue (ID551 to the bug list). I made a modification at the TeeChart for Xamarin.Android sources which seems to improve that. I'm going to send you an email with the URL to download a test version with the fix. Please let me know if it solves the problem.

Code: Select all

      g.Font.Name = "sans-serif-thin";
Thomas wrote: How to use calibri font on android?
Need i licence to use calibri, or it is free, either it is licenced by teechart?
Android has a very limited assortment of fonts:

http://stackoverflow.com/a/3532458
http://stackoverflow.com/a/13329907

TeeChart doesn't license any kind of font. In Android, you need to use Calibri as an external resource, which you already do. This thread may also help you achieve what you are looking for.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Thomas
Newbie
Newbie
Posts: 15
Joined: Thu Mar 21, 2013 12:00 am

Re: Custom font Xamarin.Android

Post by Thomas » Fri Feb 14, 2014 12:28 pm

Thank you very much. It works

Post Reply