加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何检查哪些字体包含特定字符与perl?

发布时间:2020-12-15 22:00:02 所属栏目:大数据 来源:网络整理
导读:参见英文答案 Finding out what characters a font supports6 How can one find the Unicode codepoints that a font has glyphs for,on a Debian-based system?2 这已经是问题: How to determine which fonts contain a specific character? Checking if c
参见英文答案 > Finding out what characters a font supports6
> How can one find the Unicode codepoints that a font has glyphs for,on a Debian-based system?2
这已经是问题:

> How to determine which fonts contain a specific character?
> Checking if certain characters are supported by a font

我有很多不同的字体.其中许多是“ascii only”,我需要检查什么字体包含几个重音字符. (latin – unicode codepoints – 文本编码为utf8)如:(á???éěí??ňó???????ú?ü?y?)

主要有:

> TrueType字体(扩展名为.ttf)
> TrueType集合(扩展名.ttc)
> OpenType字体(.otf)

用perl做什么常用(正确的)方法? (它是唯一的语言,我知道一点,上面的问题是C).在开始安装所有包含“font”的CPAN模块之前询问:).

我在OS X(如果这是重要的,可以安装任何macports包 – 如果它有帮助).

解决方法

对于.ttf文件,可以使用 Font::TTF及相关模块:
use Font::TTF::Font;
my $font = Font::TTF::Font->open( "C:/Windows/Fonts/ariali.ttf" );
my @supported_codepoints = sort { $a <=> $b } $font->{cmap}->reverse;

我正在走出深度,但在Font :: TTF发行版中还有一个Font :: TTF :: Ttc模块,您可以在这里分析一下,看看是否可以提取有关支持的代码点的更多信息.

(Font :: TTF的建议来自here)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读