Created
November 10, 2013 12:52
-
-
Save ohwgiles/7397880 to your computer and use it in GitHub Desktop.
test whether a font contains a glyph for a specified unicode character
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Reading fields from standard input, omit lines which contain | |
# a character which is absent in the specified font | |
# Make sure perl is invoked correctly (see PERL_UNICODE) | |
use Font::TTF::Font; | |
my $fontPath = "/usr/share/fonts/Adobe/AdobeKaitiStd.otf"; | |
my $font = Font::TTF::Font->open($fontPath); | |
while(<>) { | |
($cjCode, $utf8) = split(" "); | |
print if $font->{cmap}->ms_lookup(unpack('U', $utf8)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment