#! perl -w # Copyright 2014 Ken Takusagawa # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . print << 'EOF'; EOF ; @a=(0x1100..0x1112); @b=(0x1161..0x1175); @c=(0x11a8..0x11c2); $class{$_}=1 for(@a); $class{$_}=2 for(@b); $class{$_}=3 for(@c); @k=(@a,@b,@c); print STDERR "num jamo = ",scalar@k,"\n"; $leading_filler=0x115f; $vowel_filler=0x1160; $circle=0x110b; $line=0x1173; $first=$a[0]; $last=$c[0]; # 20 is circle printf "

Here is a Hangul Leading Jamo (Choseong) immediately followed by a Trailing Jamo (Jongseong) (&#x%x;&#x%x;). ",$first,$last; print 'By the algorithm given in Unicode TR29, Section 8.2 "Transforming into Standard Korean Syllables" (Revision 25), the browser should have inferred a Vowel Filler (Jungseong filler) between them. '; printf "Here is a Leading Jamo, Vowel Filler, and Trailing Jamo (&#x%x;&#x%x;&#x%x;). ",$first,$vowel_filler,$last; print 'Currently, in my browser there is a difference when trying to select the text. In the latter, we cannot individually select the jamo, whereas in the former we can. My browser currently does not try to render this incomplete syllable into a syllable block. It is not clear what a rendered block with a filler element should even look like. Note that the Leading Jamo changes shape depending on the Vowel:'; for(@b){ printf " &#x%x;&#x%x;&#x%x;",$first,$_,$last; } print '.

'; print '

I propose that an incomplete syllable block ought to look like Leading Fillers replaced with IEUNG (circle), and Vowel Fillers replaced with EU (horizontal line), except the fillers are invisible. '; printf "Here is the above example, except with visible EU (&#x%x;&#x%x;&#x%x;).

",$first,$line,$last; printf "

Here is a Trailing Jamo in isolation (&#x%x;). ",$last; printf "Here is a Leading Filler, Vowel Filler, and Trailing Jamo (&#x%x;&#x%x;&#x%x;). ",$leading_filler,$vowel_filler,$last; printf "Here is the fillers replaced with a circle and line (&#x%x;&#x%x;&#x%x;)

",$circle,$line,$last; print "

Here is a large random sequence of modern jamo. My browser currently only combines into blocks those corresponding to precomposed characters. In theory, any sequence of leading consonants should get combined to a cluster, similarly with vowels and trailing consonants. Word breaks happen every 3 syllables, using syllable breaking specified in TR29 referenced above. We cannot blindly place <wbr> between every jamo because that interferes with composing jamo into syllable blocks."; srand 0; $oldclass=0; $ccount=0; for(1..1000){ $c=int rand@k; $v=$k[$c]; $newclass=$class{$v}; if($newclass<$oldclass){ $ccount++; if ($ccount==3){ print ''; $ccount=0; } } $oldclass=$newclass; printf("&#x%x;",$v); } print"

"; #print "

"; #srand 0; #for(0..49){ #for(1..20){ # $c=int rand @k; # printf("&#x%x;",$k[$c]); #} #print ""; #} #print "

"; @a=(0x1100..0x115f,0xa960..0xa97c); #room for 3 more @b=(0x1161..0x1187,0xd7b0..0xd7c6); #room for 4 more @c=(0,0x11a8..0x11ff,0xd7cb..0xd7fb); #room for 4 more #tail consonant is optional, 0 is sigil #@alphabet=('a'..'z'); print STDERR "bits ",scalar@a," ",scalar@b," ",scalar@c,"\n";; print "

Here is a large collection of modern and archaic jamo (as of Unicode 7.0), but allowing only syllable forms LV and LVT (so only 2 or 3 jamo per syllable): "; srand 1; $separator=''; #$separator=', '; for$i(0..999){ print $separator if $i; printf"&#x%x;&#x%x;",$a[rand@a],$b[rand@b]; $z=$c[rand@c]; printf"&#x%x;",$z if($z); #print @alphabet[rand@alphabet]; } print "

"; print << 'EOF'; EOF