Skip to content

Commit

Permalink
Force Hangul Jamo medial vowels and final consonants to be zero width.
Browse files Browse the repository at this point in the history
Fixes #20.
  • Loading branch information
gwsw committed Aug 1, 2019
1 parent 1594008 commit cae21f8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion mkutable
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ my %force_space = (
0x0d => 1, # carriage return
);

# Hangul Jamo medial vowels and final consonants should be zero width.
my @force_compose = (
[0x1160, 0x11ff],
[0xd7b0, 0xd7c6],
[0xd7cb, 0xd7fb]
);

exit (main() ? 0 : 1);

sub main {
Expand All @@ -37,6 +44,14 @@ sub main {
}
my %out = ( 'types' => \%types );

my %force_compose;
foreach my $comp (@force_compose) {
my ($lo,$hi) = @$comp;
for (my $ch = $lo; $ch <= $hi; ++$ch) {
$force_compose{$ch} = 1;
}
}

my $date = `date`;
chomp $date;
print "/* Generated by \"$0 $args\" on $date */\n";
Expand All @@ -58,7 +73,8 @@ sub main {
my $type = $fields[$type_field];
$type =~ s/\s//g;
for ($last_code = $lo_code; $last_code <= $hi_code; ++$last_code) {
output(\%out, $last_code, $force_space{$last_code} ? 'Zs' : $type);
output(\%out, $last_code,
$force_space{$last_code} ? 'Zs' : $force_compose{$last_code} ? 'Mn' : $type);
}
}
output(\%out, $last_code);
Expand Down

0 comments on commit cae21f8

Please sign in to comment.