Page 1 of 1

Custom font Xamarin.Android

Posted: Fri Jan 24, 2014 9:33 am
by 17365504
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?

Re: Custom font Xamarin.Android

Posted: Fri Jan 24, 2014 11:58 am
by narcis
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.

Re: Custom font Xamarin.Android

Posted: Fri Feb 14, 2014 12:28 pm
by 17365504
Thank you very much. It works