简体   繁体   English

如何在iphone,ipad mini和ipad平板电脑上增加字体大小

[英]how to increace font size in iphone , ipad mini and ipad tablet

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. 我使用Xlabs字体管理器和字体提供程序来增加字体大小,但我成功了,但只有iPad所面临的问题-字体大小没有变化。 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和ipad字体大小看起来很完美,但iPad mini字体大小看起来太小 iPhone字体大小

iPad字体大小

iPad Mini字号

is it correct code? 它是正确的代码吗?

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. 检查此链接以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM