0

i am using Xlabs font manager and font provider to increase font size i got success in that but only the problem i am facing in iPad-mini no change in font size. i used bellow code to change font size

   private const short InitialSize = 18;

    /// <summary>
    /// Finds the closest.
    /// </summary>
    /// <param name="name">The name.</param>
    /// <param name="desiredHeight">Height of the desired.</param>
    /// <returns>Font.</returns>
    public Font FindClosest(string name, double desiredHeight)
    {
        var height = this.GetHeight(Font.OfSize(name, InitialSize));

        var multiply = (int)((desiredHeight / height) * InitialSize);


        var f1 = Font.OfSize(name, multiply);
        var f2 = Font.OfSize(name, multiply + 1);

        var h1 = this.GetHeight(f1);
        var h2 = this.GetHeight(f2);

        var d1 = Math.Abs(h1 - desiredHeight);
        var d2 = Math.Abs(h2 - desiredHeight);

        return d1 < d2 ? f1 : f2;
    }

iPhone and ipad Font size is look perfect but iPad mini Font size is looks too small iPhone Font Size

iPad Font Size

iPad Mini Font Size

is it correct code?

sumeet
  • 305
  • 9
  • 24

1 Answers1

2

You can try using a standard font size instead of do calculation according to screen size. Try this:

label.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));

You can either set it to small, medium, big. I find this quite useful for my app. Check this link for more details.

Lee
  • 850
  • 11
  • 23