FontAwesome Pro和xamarin.ios只有一种字体可以激活 [英] FontAwesome Pro and xamarin.ios only one font can be active

查看:72
本文介绍了FontAwesome Pro和xamarin.ios只有一种字体可以激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在寻找答案.

So I have been looking for an answer to this.

我无法让FontAwesome Pro中的所有3种字体都可以与我的xamarin本机(iOS)一起使用.

I can't get all 3 fonts in FontAwesome Pro to work with my xamarin native (iOS) to work.

我确实使用

UIFont.FromName(fontName, size);

但是"fontName"必须是Font的"family"名称,这是FontAwesome的问题,因为专业版中的所有版本都具有相同的PostScript名称.它不是文件名,而是字体的family属性.因此,当我(在Mac上)使用Fontbook时,可以看到fontawesome pro的所有三个版本(Regular,Light和Solid)都具有相同的家族名称,即"Font Awesome 5 Pro".

But the "fontName" needs to be the "family"-name of the Font, which is a problem with FontAwesome because all versions in the pro edition got the same PostScript name. Its not the filename, its the family property of the font. So when I uses (on Mac) Fontbook, I can see that all three versions (Regular, Light and Solid) of the fontawesome pro, got the same family name, which is "Font Awesome 5 Pro".

所以这意味着我只能在应用程序中使用三种字体之一.

So this means that I can only use one of the three fonts in the app.

我一直在寻找一种更改格式的解决方案,但似乎找不到任何方法.但是,如果我可以设置希望字体使用的格式,那么我想将'Light','Regular'或'Solid'定义为字体格式...

I was looking for a solution to change the format, but I can't seem to find any way to do so. But if I could set which format I wanted the font to be in, then I wanted to define 'Light', 'Regular' or 'Solid' as font formats...

这里有Fontbook的屏幕截图(很抱歉,它是丹麦语的)

推荐答案

这些字体还定义了 Postscript家族名称,您可以使用它们代替主要家族名称.

Those fonts also have Postscript family name defined you can use instead of the primary family name.

我没有专业版许可证,但是免费的v5节目:

I do not have a pro license, but the free v5 show:

  * Font Awesome 5 Free
  *-- FontAwesome5FreeRegular
  *-- FontAwesome5FreeSolid

因此您可以:

var font = UIFont.FromName(@"FontAwesome5FreeSolid", 20);
var font = UIFont.FromName(@"FontAwesome5FreeRegular", 20);

仅供参考:要显示这些名称,请使用以下命令:

FYI: To display those names, use the following:

foreach (var familyNames in UIFont.FamilyNames.OrderBy(c => c).ToList())
{
    Console.WriteLine(" * " + familyNames);
    foreach (var familyName in UIFont.FontNamesForFamilyName(familyNames).OrderBy(c => c).ToList())
    {
        Console.WriteLine(" *-- " + familyName);
    }
}

这篇关于FontAwesome Pro和xamarin.ios只有一种字体可以激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆