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

参见英文答案 > 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)如:(áäčďéěíĺľňóôöőŕřšťúůüűýž)

主要有:

> 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)

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...