6 use Test::More qw(no_plan);
8 use lib 'ext/Font-TTF/lib';
10 use Unicode::Normalize;
12 # Test that we include characters needed for strings converted to NFC
18 "\x{03b9}\x{0308}\x{0301}", # iota, combining diaeresis, combining acute
19 "s\x{0323}\x{0307}", # s, combining dot below, combining dot above
20 "s\x{0307}\x{0323}", # s, combining dot above, combining dot below
21 "\x{1e61}\x{0323}", # s with dot above, combining dot below
22 "\x{1e63}\x{0307}", # s with dot below, combining dot above
23 "\x{212b}", # angstrom
25 my $subsetter = new Font::Subsetter;
26 my %chars = $subsetter->expand_wanted_chars($str);
27 for (map ord, split //, $str) {
28 ok($chars{$_}, "char ".(sprintf '%04x', $_)." in string '".(join ' ', map { sprintf '%04x', $_ } unpack 'U*', $str)."'");
30 for (map ord, split //, Unicode::Normalize::NFC($str)) {
31 ok($chars{$_}, "NFC char ".(sprintf '%04x', $_)." in string '".(join ' ', map { sprintf '%04x', $_ } unpack 'U*', $str)."'");
35 # Test that spurious characters aren't included
39 my $subsetter = new Font::Subsetter;
40 my %chars = $subsetter->expand_wanted_chars($str);
42 $exp{$_} = 1 for map ord, split //, $str;
43 $exp{$_} = 1 for map ord, split //, Unicode::Normalize::NFC($str);
44 for (sort keys %chars) {
45 ok($exp{$_}, "expected char ".(sprintf '%04x', $_)." from string '".(join ' ', map { sprintf '%04x', $_ } unpack 'U*', $str)."'");