1 # © 2016 and later: Unicode, Inc. and others.
2 # License & terms of use: http://www.unicode.org/copyright.html#License
4 # File: Han_Spacedhan.txt
8 # Only intended for internal use
9 # Make sure Han are normalized, including characters that contain them.
10 # The first set in the filter is computed with http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[:tonfkd:/XXX/:]-[:ideographic:]-[:sc=han:]
11 # Where XXX is the resolved [:ideographic:][:sc=han:]. It needs updating with each Unicode release!
12 :: [[㆒-㆟㈠-㉇㊀-㊰㋀-㋋㍘-㍰㍻-㍿㏠-㏾ 🈐-🈒🈔-🈺🉀-🉈🉐🉑][:ideographic:][:sc=han:]] nfkc;
13 :: fullwidth-halfwidth;
15 $terminalPunct = [\.\,\:\;\?\!.,:?!。、;[:Pe:][:Pf:]];
16 $initialPunct = [:Ps:][:Pi:];
17 # add space between any Han or terminal punctuation and letters, and
18 # between letters and Han or initial punct
19 [[:Ideographic:] $terminalPunct] {} [:Letter:] → ' ' ;
20 [:Letter:] [:Mark:]* {} [[:Ideographic:] $initialPunct] → ' ' ;
21 # remove spacing between ideographs and other letters
22 ← [:Ideographic:] { ' ' } [:Letter:] ;
23 ← [:Letter:] [:Mark:]* { ' ' } [:Ideographic:] ;