1 /* GENERATED SOURCE. DO NOT MODIFY. */
2 // © 2016 and later: Unicode, Inc. and others.
3 // License & terms of use: http://www.unicode.org/copyright.html#License
4 /**
5  *******************************************************************************
6  * Copyright (C) 2001-2016 International Business Machines Corporation and
7  * others. All Rights Reserved.
8  *******************************************************************************
9  */
10 
11 package android.icu.lang;
12 
13 import java.util.BitSet;
14 import java.util.Locale;
15 
16 import android.icu.impl.UCharacterProperty;
17 import android.icu.util.ULocale;
18 
19 /**
20  * Constants for ISO 15924 script codes, and related functions.
21  *
22  * <p>The current set of script code constants supports at least all scripts
23  * that are encoded in the version of Unicode which ICU currently supports.
24  * The names of the constants are usually derived from the
25  * Unicode script property value aliases.
26  * See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/)
27  * and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt .
28  *
29  * <p>In addition, constants for many ISO 15924 script codes
30  * are included, for use with language tags, CLDR data, and similar.
31  * Some of those codes are not used in the Unicode Character Database (UCD).
32  * For example, there are no characters that have a UCD script property value of
33  * Hans or Hant. All Han ideographs have the Hani script property value in Unicode.
34  *
35  * <p>Private-use codes Qaaa..Qabx are not included, except as used in the UCD or in CLDR.
36  *
37  * <p>Starting with ICU 55, script codes are only added when their scripts
38  * have been or will certainly be encoded in Unicode,
39  * and have been assigned Unicode script property value aliases,
40  * to ensure that their script names are stable and match the names of the constants.
41  * Script codes like Latf and Aran that are not subject to separate encoding
42  * may be added at any time.
43  */
44 public final class UScript {
45     /**
46      * Invalid code
47      */
48     public static final int INVALID_CODE = -1;
49     /**
50      * Common
51      */
52     public static final int COMMON       =  0;  /* Zyyy */
53     /**
54      * Inherited
55      */
56     public static final int INHERITED    =  1;  /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */
57     /**
58      * Arabic
59      */
60     public static final int ARABIC       =  2;  /* Arab */
61     /**
62      * Armenian
63      */
64     public static final int ARMENIAN     =  3;  /* Armn */
65     /**
66      * Bengali
67      */
68     public static final int BENGALI      =  4;  /* Beng */
69     /**
70      * Bopomofo
71      */
72     public static final int BOPOMOFO     =  5;  /* Bopo */
73     /**
74      * Cherokee
75      */
76     public static final int CHEROKEE     =  6;  /* Cher */
77     /**
78      * Coptic
79      */
80     public static final int COPTIC       =  7;  /* Qaac */
81     /**
82      * Cyrillic
83      */
84     public static final int CYRILLIC     =  8;  /* Cyrl (Cyrs) */
85     /**
86      * Deseret
87      */
88     public static final int DESERET      =  9;  /* Dsrt */
89     /**
90      * Devanagari
91      */
92     public static final int DEVANAGARI   = 10;  /* Deva */
93     /**
94      * Ethiopic
95      */
96     public static final int ETHIOPIC     = 11;  /* Ethi */
97     /**
98      * Georgian
99      */
100     public static final int GEORGIAN     = 12;  /* Geor (Geon; Geoa) */
101     /**
102      * Gothic
103      */
104     public static final int GOTHIC       = 13;  /* Goth */
105     /**
106      * Greek
107      */
108     public static final int GREEK        = 14;  /* Grek */
109     /**
110      * Gujarati
111      */
112     public static final int GUJARATI     = 15;  /* Gujr */
113     /**
114      * Gurmukhi
115      */
116     public static final int GURMUKHI     = 16;  /* Guru */
117     /**
118      * Han
119      */
120     public static final int HAN          = 17;  /* Hani */
121     /**
122      * Hangul
123      */
124     public static final int HANGUL       = 18;  /* Hang */
125     /**
126      * Hebrew
127      */
128     public static final int HEBREW       = 19;  /* Hebr */
129     /**
130      * Hiragana
131      */
132     public static final int HIRAGANA     = 20;  /* Hira */
133     /**
134      * Kannada
135      */
136     public static final int KANNADA      = 21;  /* Knda */
137     /**
138      * Katakana
139      */
140     public static final int KATAKANA     = 22;  /* Kana */
141     /**
142      * Khmer
143      */
144     public static final int KHMER        = 23;  /* Khmr */
145     /**
146      * Lao
147      */
148     public static final int LAO          = 24;  /* Laoo */
149     /**
150      * Latin
151      */
152     public static final int LATIN        = 25;  /* Latn (Latf; Latg) */
153     /**
154      * Malayalam
155      */
156     public static final int MALAYALAM    = 26;  /* Mlym */
157     /**
158      * Mangolian
159      */
160     public static final int MONGOLIAN    = 27;  /* Mong */
161     /**
162      * Myammar
163      */
164     public static final int MYANMAR      = 28;  /* Mymr */
165     /**
166      * Ogham
167      */
168     public static final int OGHAM        = 29;  /* Ogam */
169     /**
170      * Old Itallic
171      */
172     public static final int OLD_ITALIC   = 30;  /* Ital */
173     /**
174      * Oriya
175      */
176     public static final int ORIYA        = 31;  /* Orya */
177     /**
178      * Runic
179      */
180     public static final int RUNIC        = 32;  /* Runr */
181     /**
182      * Sinhala
183      */
184     public static final int SINHALA      = 33;  /* Sinh */
185     /**
186      * Syriac
187      */
188     public static final int SYRIAC       = 34;  /* Syrc (Syrj; Syrn; Syre) */
189     /**
190      * Tamil
191      */
192     public static final int TAMIL        = 35;  /* Taml */
193     /**
194      * Telugu
195      */
196     public static final int TELUGU       = 36;  /* Telu */
197     /**
198      * Thana
199      */
200     public static final int THAANA       = 37;  /* Thaa */
201     /**
202      * Thai
203      */
204     public static final int THAI         = 38;  /* Thai */
205     /**
206      * Tibetan
207      */
208     public static final int TIBETAN      = 39;  /* Tibt */
209     /**
210      * Unified Canadian Aboriginal Symbols
211      */
212     public static final int CANADIAN_ABORIGINAL = 40;  /* Cans */
213     /**
214      * Unified Canadian Aboriginal Symbols (alias)
215      */
216     public static final int UCAS         = CANADIAN_ABORIGINAL;  /* Cans */
217     /**
218      * Yi syllables
219      */
220     public static final int YI           = 41;  /* Yiii */
221     /**
222      * Tagalog
223      */
224     public static final int TAGALOG      = 42;  /* Tglg */
225     /**
226      * Hanunooo
227      */
228     public static final int HANUNOO      = 43;  /* Hano */
229     /**
230      * Buhid
231      */
232     public static final int BUHID        = 44;  /* Buhd */
233     /**
234      * Tagbanwa
235      */
236     public static final int TAGBANWA     = 45;  /* Tagb */
237     /**
238      * Braille
239      * Script in Unicode 4
240      *
241      */
242     public static final int BRAILLE      = 46;  /* Brai */
243     /**
244      * Cypriot
245      * Script in Unicode 4
246      *
247      */
248     public static final int CYPRIOT              = 47;  /* Cprt */
249     /**
250      * Limbu
251      * Script in Unicode 4
252      *
253      */
254     public static final int LIMBU                = 48;  /* Limb */
255     /**
256      * Linear B
257      * Script in Unicode 4
258      *
259      */
260     public static final int LINEAR_B     = 49;  /* Linb */
261     /**
262      * Osmanya
263      * Script in Unicode 4
264      *
265      */
266     public static final int OSMANYA              = 50;  /* Osma */
267     /**
268      * Shavian
269      * Script in Unicode 4
270      *
271      */
272     public static final int SHAVIAN              = 51;  /* Shaw */
273     /**
274      * Tai Le
275      * Script in Unicode 4
276      *
277      */
278     public static final int TAI_LE               = 52;  /* Tale */
279     /**
280      * Ugaritic
281      * Script in Unicode 4
282      *
283      */
284     public static final int UGARITIC     = 53;  /* Ugar */
285     /**
286      * Script in Unicode 4.0.1
287      */
288     public static final int KATAKANA_OR_HIRAGANA = 54;  /*Hrkt */
289 
290     /**
291      * Script in Unicode 4.1
292      */
293     public static final int BUGINESE = 55;           /* Bugi */
294     /**
295      * Script in Unicode 4.1
296      */
297     public static final int GLAGOLITIC = 56;         /* Glag */
298     /**
299      * Script in Unicode 4.1
300      */
301     public static final int KHAROSHTHI = 57;         /* Khar */
302     /**
303      * Script in Unicode 4.1
304      */
305     public static final int SYLOTI_NAGRI = 58;       /* Sylo */
306     /**
307      * Script in Unicode 4.1
308      */
309     public static final int NEW_TAI_LUE = 59;        /* Talu */
310     /**
311      * Script in Unicode 4.1
312      */
313     public static final int TIFINAGH = 60;           /* Tfng */
314     /**
315      * Script in Unicode 4.1
316      */
317     public static final int OLD_PERSIAN = 61;        /* Xpeo */
318 
319 
320     /**
321      * ISO 15924 script code
322      */
323     public static final int BALINESE                      = 62; /* Bali */
324     /**
325      * ISO 15924 script code
326      */
327     public static final int BATAK                         = 63; /* Batk */
328     /**
329      * ISO 15924 script code
330      */
331     public static final int BLISSYMBOLS                   = 64; /* Blis */
332     /**
333      * ISO 15924 script code
334      */
335     public static final int BRAHMI                        = 65; /* Brah */
336     /**
337      * ISO 15924 script code
338      */
339     public static final int CHAM                          = 66; /* Cham */
340     /**
341      * ISO 15924 script code
342      */
343     public static final int CIRTH                         = 67; /* Cirt */
344     /**
345      * ISO 15924 script code
346      */
347     public static final int OLD_CHURCH_SLAVONIC_CYRILLIC  = 68; /* Cyrs */
348     /**
349      * ISO 15924 script code
350      */
351     public static final int DEMOTIC_EGYPTIAN              = 69; /* Egyd */
352     /**
353      * ISO 15924 script code
354      */
355     public static final int HIERATIC_EGYPTIAN             = 70; /* Egyh */
356     /**
357      * ISO 15924 script code
358      */
359     public static final int EGYPTIAN_HIEROGLYPHS          = 71; /* Egyp */
360     /**
361      * ISO 15924 script code
362      */
363     public static final int KHUTSURI                      = 72; /* Geok */
364     /**
365      * ISO 15924 script code
366      */
367     public static final int SIMPLIFIED_HAN                = 73; /* Hans */
368     /**
369      * ISO 15924 script code
370      */
371     public static final int TRADITIONAL_HAN               = 74; /* Hant */
372     /**
373      * ISO 15924 script code
374      */
375     public static final int PAHAWH_HMONG                  = 75; /* Hmng */
376     /**
377      * ISO 15924 script code
378      */
379     public static final int OLD_HUNGARIAN                 = 76; /* Hung */
380     /**
381      * ISO 15924 script code
382      */
383     public static final int HARAPPAN_INDUS                = 77; /* Inds */
384     /**
385      * ISO 15924 script code
386      */
387     public static final int JAVANESE                      = 78; /* Java */
388     /**
389      * ISO 15924 script code
390      */
391     public static final int KAYAH_LI                      = 79; /* Kali */
392     /**
393      * ISO 15924 script code
394      */
395     public static final int LATIN_FRAKTUR                 = 80; /* Latf */
396     /**
397      * ISO 15924 script code
398      */
399     public static final int LATIN_GAELIC                  = 81; /* Latg */
400     /**
401      * ISO 15924 script code
402      */
403     public static final int LEPCHA                        = 82; /* Lepc */
404     /**
405      * ISO 15924 script code
406      */
407     public static final int LINEAR_A                      = 83; /* Lina */
408     /**
409      * ISO 15924 script code
410      */
411     public static final int MANDAIC                       = 84; /* Mand */
412     /**
413      * ISO 15924 script code
414      */
415     public static final int MANDAEAN                      = MANDAIC;
416     /**
417      * ISO 15924 script code
418      */
419     public static final int MAYAN_HIEROGLYPHS             = 85; /* Maya */
420     /**
421      * ISO 15924 script code
422      */
423     public static final int MEROITIC_HIEROGLYPHS          = 86; /* Mero */
424     /**
425      * ISO 15924 script code
426      */
427     public static final int MEROITIC                      = MEROITIC_HIEROGLYPHS;
428     /**
429      * ISO 15924 script code
430      */
431     public static final int NKO                           = 87; /* Nkoo */
432     /**
433      * ISO 15924 script code
434      */
435     public static final int ORKHON                        = 88; /* Orkh */
436     /**
437      * ISO 15924 script code
438      */
439     public static final int OLD_PERMIC                    = 89; /* Perm */
440     /**
441      * ISO 15924 script code
442      */
443     public static final int PHAGS_PA                      = 90; /* Phag */
444     /**
445      * ISO 15924 script code
446      */
447     public static final int PHOENICIAN                    = 91; /* Phnx */
448     /**
449      * ISO 15924 script code
450      */
451     public static final int MIAO                          = 92; /* Plrd */
452     /**
453      * ISO 15924 script code
454      */
455     public static final int PHONETIC_POLLARD              = MIAO;
456     /**
457      * ISO 15924 script code
458      */
459     public static final int RONGORONGO                    = 93; /* Roro */
460     /**
461      * ISO 15924 script code
462      */
463     public static final int SARATI                        = 94; /* Sara */
464     /**
465      * ISO 15924 script code
466      */
467     public static final int ESTRANGELO_SYRIAC             = 95; /* Syre */
468     /**
469      * ISO 15924 script code
470      */
471     public static final int WESTERN_SYRIAC                = 96; /* Syrj */
472     /**
473      * ISO 15924 script code
474      */
475     public static final int EASTERN_SYRIAC                = 97; /* Syrn */
476     /**
477      * ISO 15924 script code
478      */
479     public static final int TENGWAR                       = 98; /* Teng */
480     /**
481      * ISO 15924 script code
482      */
483     public static final int VAI                           = 99; /* Vaii */
484     /**
485      * ISO 15924 script code
486      */
487     public static final int VISIBLE_SPEECH                = 100;/* Visp */
488     /**
489      * ISO 15924 script code
490      */
491     public static final int CUNEIFORM                     = 101;/* Xsux */
492     /**
493      * ISO 15924 script code
494      */
495     public static final int UNWRITTEN_LANGUAGES           = 102;/* Zxxx */
496     /**
497      * ISO 15924 script code
498      */
499     public static final int UNKNOWN                       = 103;/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
500 
501     /**
502      * ISO 15924 script code
503      */
504     public static final int CARIAN                        = 104;/* Cari */
505     /**
506      * ISO 15924 script code
507      */
508     public static final int JAPANESE                      = 105;/* Jpan */
509     /**
510      * ISO 15924 script code
511      */
512     public static final int LANNA                         = 106;/* Lana */
513     /**
514      * ISO 15924 script code
515      */
516     public static final int LYCIAN                        = 107;/* Lyci */
517     /**
518      * ISO 15924 script code
519      */
520     public static final int LYDIAN                        = 108;/* Lydi */
521     /**
522      * ISO 15924 script code
523      */
524     public static final int OL_CHIKI                      = 109;/* Olck */
525     /**
526      * ISO 15924 script code
527      */
528     public static final int REJANG                        = 110;/* Rjng */
529     /**
530      * ISO 15924 script code
531      */
532     public static final int SAURASHTRA                    = 111;/* Saur */
533     /**
534      * ISO 15924 script code for Sutton SignWriting
535      */
536     public static final int SIGN_WRITING                  = 112;/* Sgnw */
537     /**
538      * ISO 15924 script code
539      */
540     public static final int SUNDANESE                     = 113;/* Sund */
541     /**
542      * ISO 15924 script code
543      */
544     public static final int MOON                          = 114;/* Moon */
545     /**
546      * ISO 15924 script code
547      */
548     public static final int MEITEI_MAYEK                  = 115;/* Mtei */
549 
550     /**
551      * ISO 15924 script code
552      */
553     public static final int IMPERIAL_ARAMAIC              = 116;/* Armi */
554 
555     /**
556      * ISO 15924 script code
557      */
558     public static final int AVESTAN                       = 117;/* Avst */
559 
560     /**
561      * ISO 15924 script code
562      */
563     public static final int CHAKMA                        = 118;/* Cakm */
564 
565     /**
566      * ISO 15924 script code
567      */
568     public static final int KOREAN                        = 119;/* Kore */
569 
570     /**
571      * ISO 15924 script code
572      */
573     public static final int KAITHI                        = 120;/* Kthi */
574 
575     /**
576      * ISO 15924 script code
577      */
578     public static final int MANICHAEAN                    = 121;/* Mani */
579 
580     /**
581      * ISO 15924 script code
582      */
583     public static final int INSCRIPTIONAL_PAHLAVI         = 122;/* Phli */
584 
585     /**
586      * ISO 15924 script code
587      */
588     public static final int PSALTER_PAHLAVI               = 123;/* Phlp */
589 
590     /**
591      * ISO 15924 script code
592      */
593     public static final int BOOK_PAHLAVI                  = 124;/* Phlv */
594 
595     /**
596      * ISO 15924 script code
597      */
598     public static final int INSCRIPTIONAL_PARTHIAN        = 125;/* Prti */
599 
600     /**
601      * ISO 15924 script code
602      */
603     public static final int SAMARITAN                     = 126;/* Samr */
604 
605     /**
606      * ISO 15924 script code
607      */
608     public static final int TAI_VIET                      = 127;/* Tavt */
609 
610     /**
611      * ISO 15924 script code
612      */
613     public static final int MATHEMATICAL_NOTATION         = 128;/* Zmth */
614 
615     /**
616      * ISO 15924 script code
617      */
618     public static final int SYMBOLS                       = 129;/* Zsym */
619 
620     /**
621      * ISO 15924 script code
622      */
623     public static final int BAMUM                         = 130;/* Bamu */
624     /**
625      * ISO 15924 script code
626      */
627     public static final int LISU                          = 131;/* Lisu */
628     /**
629      * ISO 15924 script code
630      */
631     public static final int NAKHI_GEBA                    = 132;/* Nkgb */
632     /**
633      * ISO 15924 script code
634      */
635     public static final int OLD_SOUTH_ARABIAN             = 133;/* Sarb */
636 
637     /**
638      * ISO 15924 script code
639      */
640     public static final int BASSA_VAH                     = 134;/* Bass */
641     /**
642      * ISO 15924 script code
643      */
644     public static final int DUPLOYAN                      = 135;/* Dupl */
645     /**
646      * Typo, use DUPLOYAN
647      * @deprecated ICU 54
648      * @hide original deprecated declaration
649      */
650     @Deprecated
651     public static final int DUPLOYAN_SHORTAND             = DUPLOYAN;
652     /**
653      * ISO 15924 script code
654      */
655     public static final int ELBASAN                       = 136;/* Elba */
656     /**
657      * ISO 15924 script code
658      */
659     public static final int GRANTHA                       = 137;/* Gran */
660     /**
661      * ISO 15924 script code
662      */
663     public static final int KPELLE                        = 138;/* Kpel */
664     /**
665      * ISO 15924 script code
666      */
667     public static final int LOMA                          = 139;/* Loma */
668     /**
669      * Mende Kikakui
670      * ISO 15924 script code
671      */
672     public static final int MENDE                         = 140;/* Mend */
673     /**
674      * ISO 15924 script code
675      */
676     public static final int MEROITIC_CURSIVE              = 141;/* Merc */
677     /**
678      * ISO 15924 script code
679      */
680     public static final int OLD_NORTH_ARABIAN             = 142;/* Narb */
681     /**
682      * ISO 15924 script code
683      */
684     public static final int NABATAEAN                     = 143;/* Nbat */
685     /**
686      * ISO 15924 script code
687      */
688     public static final int PALMYRENE                     = 144;/* Palm */
689     /**
690      * ISO 15924 script code
691      */
692     public static final int KHUDAWADI                     = 145;/* Sind */
693     /**
694      * ISO 15924 script code
695      */
696     public static final int SINDHI = KHUDAWADI;
697     /**
698      * ISO 15924 script code
699      */
700     public static final int WARANG_CITI                   = 146;/* Wara */
701 
702     /**
703      * ISO 15924 script code
704      */
705     public static final int AFAKA = 147;/* Afak */
706     /**
707      * ISO 15924 script code
708      */
709     public static final int JURCHEN = 148;/* Jurc */
710     /**
711      * ISO 15924 script code
712      */
713     public static final int MRO = 149;/* Mroo */
714     /**
715      * ISO 15924 script code
716      */
717     public static final int NUSHU = 150;/* Nshu */
718     /**
719      * ISO 15924 script code
720      */
721     public static final int SHARADA = 151;/* Shrd */
722     /**
723      * ISO 15924 script code
724      */
725     public static final int SORA_SOMPENG = 152;/* Sora */
726     /**
727      * ISO 15924 script code
728      */
729     public static final int TAKRI = 153;/* Takr */
730     /**
731      * ISO 15924 script code
732      */
733     public static final int TANGUT = 154;/* Tang */
734     /**
735      * ISO 15924 script code
736      */
737     public static final int WOLEAI = 155;/* Wole */
738 
739     /**
740      * ISO 15924 script code
741      */
742     public static final int ANATOLIAN_HIEROGLYPHS = 156;/* Hluw */
743     /**
744      * ISO 15924 script code
745      */
746     public static final int KHOJKI = 157;/* Khoj */
747     /**
748      * ISO 15924 script code
749      */
750     public static final int TIRHUTA = 158;/* Tirh */
751     /**
752      * ISO 15924 script code
753      */
754     public static final int CAUCASIAN_ALBANIAN = 159; /* Aghb */
755     /**
756      * ISO 15924 script code
757      */
758     public static final int MAHAJANI = 160; /* Mahj */
759 
760     /**
761      * ISO 15924 script code
762      */
763     public static final int AHOM = 161; /* Ahom */
764     /**
765      * ISO 15924 script code
766      */
767     public static final int HATRAN = 162; /* Hatr */
768     /**
769      * ISO 15924 script code
770      */
771     public static final int MODI = 163; /* Modi */
772     /**
773      * ISO 15924 script code
774      */
775     public static final int MULTANI = 164; /* Mult */
776     /**
777      * ISO 15924 script code
778      */
779     public static final int PAU_CIN_HAU = 165; /* Pauc */
780     /**
781      * ISO 15924 script code
782      */
783     public static final int SIDDHAM = 166; /* Sidd */
784 
785     /**
786      * ISO 15924 script code
787      */
788     public static final int ADLAM = 167; /* Adlm */
789     /**
790      * ISO 15924 script code
791      */
792     public static final int BHAIKSUKI = 168; /* Bhks */
793     /**
794      * ISO 15924 script code
795      */
796     public static final int MARCHEN = 169; /* Marc */
797     /**
798      * ISO 15924 script code
799      */
800     public static final int NEWA = 170; /* Newa */
801     /**
802      * ISO 15924 script code
803      */
804     public static final int OSAGE = 171; /* Osge */
805 
806     /**
807      * ISO 15924 script code
808      */
809     public static final int HAN_WITH_BOPOMOFO = 172; /* Hanb */
810     /**
811      * ISO 15924 script code
812      */
813     public static final int JAMO = 173; /* Jamo */
814     /**
815      * ISO 15924 script code
816      */
817     public static final int SYMBOLS_EMOJI = 174; /* Zsye */
818 
819     /**
820      * ISO 15924 script code
821      */
822     public static final int MASARAM_GONDI = 175; /* Gonm */
823     /**
824      * ISO 15924 script code
825      */
826     public static final int SOYOMBO = 176; /* Soyo */
827     /**
828      * ISO 15924 script code
829      */
830     public static final int ZANABAZAR_SQUARE = 177; /* Zanb */
831 
832     /**
833      * ISO 15924 script code
834      */
835     public static final int DOGRA = 178; /* Dogr */
836     /***/
837     public static final int GUNJALA_GONDI = 179; /* Gong */
838     /***/
839     public static final int MAKASAR = 180; /* Maka */
840     /***/
841     public static final int MEDEFAIDRIN = 181; /* Medf */
842     /***/
843     public static final int HANIFI_ROHINGYA = 182; /* Rohg */
844     /***/
845     public static final int SOGDIAN = 183; /* Sogd */
846     /***/
847     public static final int OLD_SOGDIAN = 184; /* Sogo */
848 
849     /**
850      * One more than the highest normal UScript code.
851      * The highest value is available via UCharacter.getIntPropertyMaxValue(UProperty.SCRIPT).
852      *
853      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
854      * @hide unsupported on Android
855      */
856     @Deprecated
857     public static final int CODE_LIMIT   = 185;
858 
getCodesFromLocale(ULocale locale)859     private static int[] getCodesFromLocale(ULocale locale) {
860         // Multi-script languages, equivalent to the LocaleScript data
861         // that we used to load from locale resource bundles.
862         String lang = locale.getLanguage();
863         if(lang.equals("ja")) {
864             return new int[] { UScript.KATAKANA, UScript.HIRAGANA, UScript.HAN };
865         }
866         if(lang.equals("ko")) {
867             return new int[] { UScript.HANGUL, UScript.HAN };
868         }
869         String script = locale.getScript();
870         if(lang.equals("zh") && script.equals("Hant")) {
871             return new int[] { UScript.HAN, UScript.BOPOMOFO };
872         }
873         // Explicit script code.
874         if(script.length() != 0) {
875             int scriptCode = UScript.getCodeFromName(script);
876             if(scriptCode != UScript.INVALID_CODE) {
877                 if(scriptCode == UScript.SIMPLIFIED_HAN || scriptCode == UScript.TRADITIONAL_HAN) {
878                     scriptCode = UScript.HAN;
879                 }
880                 return new int[] { scriptCode };
881             }
882         }
883         return null;
884     }
885 
886     /**
887      * Helper function to find the code from locale.
888      * @param locale The locale.
889      */
findCodeFromLocale(ULocale locale)890     private static int[] findCodeFromLocale(ULocale locale) {
891         int[] result = getCodesFromLocale(locale);
892         if(result != null) {
893             return result;
894         }
895         ULocale likely = ULocale.addLikelySubtags(locale);
896         return getCodesFromLocale(likely);
897     }
898 
899     /**
900      * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.
901      * Returns MALAYAM given "Malayam" OR "Mlym".
902      * Returns LATIN given "en" OR "en_US"
903      * @param locale Locale
904      * @return The script codes array. null if the the code cannot be found.
905      */
getCode(Locale locale)906     public static final int[] getCode(Locale locale){
907         return findCodeFromLocale(ULocale.forLocale(locale));
908     }
909     /**
910      * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.
911      * Returns MALAYAM given "Malayam" OR "Mlym".
912      * Returns LATIN given "en" OR "en_US"
913      * @param locale ULocale
914      * @return The script codes array. null if the the code cannot be found.
915      */
getCode(ULocale locale)916     public static final int[] getCode(ULocale locale){
917         return findCodeFromLocale(locale);
918     }
919     /**
920      * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name.
921      * Returns MALAYAM given "Malayam" OR "Mlym".
922      * Returns LATIN given "en" OR "en_US"
923      *
924      * <p>Note: To search by short or long script alias only, use
925      * {@link #getCodeFromName(String)} instead.
926      * That does a fast lookup with no access of the locale data.
927      *
928      * @param nameOrAbbrOrLocale name of the script or ISO 15924 code or locale
929      * @return The script codes array. null if the the code cannot be found.
930      */
getCode(String nameOrAbbrOrLocale)931     public static final int[] getCode(String nameOrAbbrOrLocale) {
932         boolean triedCode = false;
933         if (nameOrAbbrOrLocale.indexOf('_') < 0 && nameOrAbbrOrLocale.indexOf('-') < 0) {
934             int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale);
935             if (propNum != UProperty.UNDEFINED) {
936                 return new int[] {propNum};
937             }
938             triedCode = true;
939         }
940         int[] scripts = findCodeFromLocale(new ULocale(nameOrAbbrOrLocale));
941         if (scripts != null) {
942             return scripts;
943         }
944         if (!triedCode) {
945             int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale);
946             if (propNum != UProperty.UNDEFINED) {
947                 return new int[] {propNum};
948             }
949         }
950         return null;
951     }
952 
953     /**
954      * Returns the script code associated with the given Unicode script property alias
955      * (name or abbreviation).
956      * Short aliases are ISO 15924 script codes.
957      * Returns MALAYAM given "Malayam" OR "Mlym".
958      *
959      * @param nameOrAbbr name of the script or ISO 15924 code
960      * @return The script code value, or INVALID_CODE if the code cannot be found.
961      */
getCodeFromName(String nameOrAbbr)962     public static final int getCodeFromName(String nameOrAbbr) {
963         int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbr);
964         return propNum == UProperty.UNDEFINED ? INVALID_CODE : propNum;
965     }
966 
967     /**
968      * Gets the script code associated with the given codepoint.
969      * Returns UScript.MALAYAM given 0x0D02
970      * @param codepoint UChar32 codepoint
971      * @return The script code
972      */
getScript(int codepoint)973     public static final int getScript(int codepoint){
974         if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) {
975             int scriptX=UCharacterProperty.INSTANCE.getAdditional(codepoint, 0)&UCharacterProperty.SCRIPT_X_MASK;
976             if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
977                 return scriptX;
978             } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_INHERITED) {
979                 return UScript.COMMON;
980             } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_OTHER) {
981                 return UScript.INHERITED;
982             } else {
983                 return UCharacterProperty.INSTANCE.m_scriptExtensions_[scriptX&UCharacterProperty.SCRIPT_MASK_];
984             }
985         }else{
986             throw new IllegalArgumentException(Integer.toString(codepoint));
987         }
988     }
989 
990     /**
991      * Do the Script_Extensions of code point c contain script sc?
992      * If c does not have explicit Script_Extensions, then this tests whether
993      * c has the Script property value sc.
994      *
995      * <p>Some characters are commonly used in multiple scripts.
996      * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
997      *
998      * @param c code point
999      * @param sc script code
1000      * @return true if sc is in Script_Extensions(c)
1001      */
hasScript(int c, int sc)1002     public static final boolean hasScript(int c, int sc) {
1003         int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
1004         if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
1005             return sc==scriptX;
1006         }
1007 
1008         char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
1009         int scx=scriptX&UCharacterProperty.SCRIPT_MASK_;  // index into scriptExtensions
1010         if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
1011             scx=scriptExtensions[scx+1];
1012         }
1013         if(sc>0x7fff) {
1014             // Guard against bogus input that would
1015             // make us go past the Script_Extensions terminator.
1016             return false;
1017         }
1018         while(sc>scriptExtensions[scx]) {
1019             ++scx;
1020         }
1021         return sc==(scriptExtensions[scx]&0x7fff);
1022     }
1023 
1024     /**
1025      * Sets code point c's Script_Extensions as script code integers into the output BitSet.
1026      * <ul>
1027      * <li>If c does have Script_Extensions, then the return value is
1028      * the negative number of Script_Extensions codes (= -set.cardinality());
1029      * in this case, the Script property value
1030      * (normally Common or Inherited) is not included in the set.
1031      * <li>If c does not have Script_Extensions, then the one Script code is put into the set
1032      * and also returned.
1033      * <li>If c is not a valid code point, then the one {@link #UNKNOWN} code is put into the set
1034      * and also returned.
1035      * </ul>
1036      * In other words, if the return value is non-negative, it is c's single Script code
1037      * and the set contains exactly this Script code.
1038      * If the return value is -n, then the set contains c's n&gt;=2 Script_Extensions script codes.
1039      *
1040      * <p>Some characters are commonly used in multiple scripts.
1041      * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
1042      *
1043      * @param c code point
1044      * @param set set of script code integers; will be cleared, then bits are set
1045      *            corresponding to c's Script_Extensions
1046      * @return negative number of script codes in c's Script_Extensions,
1047      *         or the non-negative single Script value
1048      */
getScriptExtensions(int c, BitSet set)1049     public static final int getScriptExtensions(int c, BitSet set) {
1050         set.clear();
1051         int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
1052         if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
1053             set.set(scriptX);
1054             return scriptX;
1055         }
1056 
1057         char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
1058         int scx=scriptX&UCharacterProperty.SCRIPT_MASK_;  // index into scriptExtensions
1059         if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
1060             scx=scriptExtensions[scx+1];
1061         }
1062         int length=0;
1063         int sx;
1064         do {
1065             sx=scriptExtensions[scx++];
1066             set.set(sx&0x7fff);
1067             ++length;
1068         } while(sx<0x8000);
1069         // length==set.cardinality()
1070         return -length;
1071     }
1072 
1073     /**
1074      * Returns the long Unicode script name, if there is one.
1075      * Otherwise returns the 4-letter ISO 15924 script code.
1076      * Returns "Malayam" given MALAYALAM.
1077      *
1078      * @param scriptCode int script code
1079      * @return long script name as given in PropertyValueAliases.txt, or the 4-letter code
1080      * @throws IllegalArgumentException if the script code is not valid
1081      */
getName(int scriptCode)1082     public static final String getName(int scriptCode){
1083         return UCharacter.getPropertyValueName(UProperty.SCRIPT,
1084                 scriptCode,
1085                 UProperty.NameChoice.LONG);
1086     }
1087 
1088     /**
1089      * Returns the 4-letter ISO 15924 script code,
1090      * which is the same as the short Unicode script name if Unicode has names for the script.
1091      * Returns "Mlym" given MALAYALAM.
1092      *
1093      * @param scriptCode int script code
1094      * @return short script name (4-letter code)
1095      * @throws IllegalArgumentException if the script code is not valid
1096      */
getShortName(int scriptCode)1097     public static final String getShortName(int scriptCode){
1098         return UCharacter.getPropertyValueName(UProperty.SCRIPT,
1099                 scriptCode,
1100                 UProperty.NameChoice.SHORT);
1101     }
1102 
1103     /**
1104      * Script metadata (script properties).
1105      * See http://unicode.org/cldr/trac/browser/trunk/common/properties/scriptMetadata.txt
1106      */
1107     private static final class ScriptMetadata {
1108         // 0 = NOT_ENCODED, no sample character, default false script properties.
1109         // Bits 20.. 0: sample character
1110 
1111         // Bits 23..21: usage
1112         private static final int UNKNOWN = 1 << 21;
1113         private static final int EXCLUSION = 2 << 21;
1114         private static final int LIMITED_USE = 3 << 21;
1115         // vate static final int ASPIRATIONAL = 4 << 21; -- not used any more since Unicode 10
1116         private static final int RECOMMENDED = 5 << 21;
1117 
1118         // Bits 31..24: Single-bit flags
1119         private static final int RTL = 1 << 24;
1120         private static final int LB_LETTERS = 1 << 25;
1121         private static final int CASED = 1 << 26;
1122 
1123         private static final int SCRIPT_PROPS[] = {
1124             // Begin copy-paste output from
1125             // tools/trunk/unicode/py/parsescriptmetadata.py
1126             // or from icu/trunk/source/common/uscript_props.cpp
1127             0x0040 | RECOMMENDED,  // Zyyy
1128             0x0308 | RECOMMENDED,  // Zinh
1129             0x0628 | RECOMMENDED | RTL,  // Arab
1130             0x0531 | RECOMMENDED | CASED,  // Armn
1131             0x0995 | RECOMMENDED,  // Beng
1132             0x3105 | RECOMMENDED | LB_LETTERS,  // Bopo
1133             0x13C4 | LIMITED_USE | CASED,  // Cher
1134             0x03E2 | EXCLUSION | CASED,  // Copt
1135             0x042F | RECOMMENDED | CASED,  // Cyrl
1136             0x10414 | EXCLUSION | CASED,  // Dsrt
1137             0x0905 | RECOMMENDED,  // Deva
1138             0x12A0 | RECOMMENDED,  // Ethi
1139             0x10D3 | RECOMMENDED,  // Geor
1140             0x10330 | EXCLUSION,  // Goth
1141             0x03A9 | RECOMMENDED | CASED,  // Grek
1142             0x0A95 | RECOMMENDED,  // Gujr
1143             0x0A15 | RECOMMENDED,  // Guru
1144             0x5B57 | RECOMMENDED | LB_LETTERS,  // Hani
1145             0xAC00 | RECOMMENDED,  // Hang
1146             0x05D0 | RECOMMENDED | RTL,  // Hebr
1147             0x304B | RECOMMENDED | LB_LETTERS,  // Hira
1148             0x0C95 | RECOMMENDED,  // Knda
1149             0x30AB | RECOMMENDED | LB_LETTERS,  // Kana
1150             0x1780 | RECOMMENDED | LB_LETTERS,  // Khmr
1151             0x0EA5 | RECOMMENDED | LB_LETTERS,  // Laoo
1152             0x004C | RECOMMENDED | CASED,  // Latn
1153             0x0D15 | RECOMMENDED,  // Mlym
1154             0x1826 | EXCLUSION,  // Mong
1155             0x1000 | RECOMMENDED | LB_LETTERS,  // Mymr
1156             0x168F | EXCLUSION,  // Ogam
1157             0x10300 | EXCLUSION,  // Ital
1158             0x0B15 | RECOMMENDED,  // Orya
1159             0x16A0 | EXCLUSION,  // Runr
1160             0x0D85 | RECOMMENDED,  // Sinh
1161             0x0710 | LIMITED_USE | RTL,  // Syrc
1162             0x0B95 | RECOMMENDED,  // Taml
1163             0x0C15 | RECOMMENDED,  // Telu
1164             0x078C | RECOMMENDED | RTL,  // Thaa
1165             0x0E17 | RECOMMENDED | LB_LETTERS,  // Thai
1166             0x0F40 | RECOMMENDED,  // Tibt
1167             0x14C0 | LIMITED_USE,  // Cans
1168             0xA288 | LIMITED_USE | LB_LETTERS,  // Yiii
1169             0x1703 | EXCLUSION,  // Tglg
1170             0x1723 | EXCLUSION,  // Hano
1171             0x1743 | EXCLUSION,  // Buhd
1172             0x1763 | EXCLUSION,  // Tagb
1173             0x280E | UNKNOWN,  // Brai
1174             0x10800 | EXCLUSION | RTL,  // Cprt
1175             0x1900 | LIMITED_USE,  // Limb
1176             0x10000 | EXCLUSION,  // Linb
1177             0x10480 | EXCLUSION,  // Osma
1178             0x10450 | EXCLUSION,  // Shaw
1179             0x1950 | LIMITED_USE | LB_LETTERS,  // Tale
1180             0x10380 | EXCLUSION,  // Ugar
1181             0,
1182             0x1A00 | EXCLUSION,  // Bugi
1183             0x2C00 | EXCLUSION | CASED,  // Glag
1184             0x10A00 | EXCLUSION | RTL,  // Khar
1185             0xA800 | LIMITED_USE,  // Sylo
1186             0x1980 | LIMITED_USE | LB_LETTERS,  // Talu
1187             0x2D30 | LIMITED_USE,  // Tfng
1188             0x103A0 | EXCLUSION,  // Xpeo
1189             0x1B05 | LIMITED_USE,  // Bali
1190             0x1BC0 | LIMITED_USE,  // Batk
1191             0,
1192             0x11005 | EXCLUSION,  // Brah
1193             0xAA00 | LIMITED_USE,  // Cham
1194             0,
1195             0,
1196             0,
1197             0,
1198             0x13153 | EXCLUSION,  // Egyp
1199             0,
1200             0x5B57 | RECOMMENDED | LB_LETTERS,  // Hans
1201             0x5B57 | RECOMMENDED | LB_LETTERS,  // Hant
1202             0x16B1C | EXCLUSION,  // Hmng
1203             0x10CA1 | EXCLUSION | RTL | CASED,  // Hung
1204             0,
1205             0xA984 | LIMITED_USE,  // Java
1206             0xA90A | LIMITED_USE,  // Kali
1207             0,
1208             0,
1209             0x1C00 | LIMITED_USE,  // Lepc
1210             0x10647 | EXCLUSION,  // Lina
1211             0x0840 | LIMITED_USE | RTL,  // Mand
1212             0,
1213             0x10980 | EXCLUSION | RTL,  // Mero
1214             0x07CA | LIMITED_USE | RTL,  // Nkoo
1215             0x10C00 | EXCLUSION | RTL,  // Orkh
1216             0x1036B | EXCLUSION,  // Perm
1217             0xA840 | EXCLUSION,  // Phag
1218             0x10900 | EXCLUSION | RTL,  // Phnx
1219             0x16F00 | LIMITED_USE,  // Plrd
1220             0,
1221             0,
1222             0,
1223             0,
1224             0,
1225             0,
1226             0xA549 | LIMITED_USE,  // Vaii
1227             0,
1228             0x12000 | EXCLUSION,  // Xsux
1229             0,
1230             0xFDD0 | UNKNOWN,  // Zzzz
1231             0x102A0 | EXCLUSION,  // Cari
1232             0x304B | RECOMMENDED | LB_LETTERS,  // Jpan
1233             0x1A20 | LIMITED_USE | LB_LETTERS,  // Lana
1234             0x10280 | EXCLUSION,  // Lyci
1235             0x10920 | EXCLUSION | RTL,  // Lydi
1236             0x1C5A | LIMITED_USE,  // Olck
1237             0xA930 | EXCLUSION,  // Rjng
1238             0xA882 | LIMITED_USE,  // Saur
1239             0x1D850 | EXCLUSION,  // Sgnw
1240             0x1B83 | LIMITED_USE,  // Sund
1241             0,
1242             0xABC0 | LIMITED_USE,  // Mtei
1243             0x10840 | EXCLUSION | RTL,  // Armi
1244             0x10B00 | EXCLUSION | RTL,  // Avst
1245             0x11103 | LIMITED_USE,  // Cakm
1246             0xAC00 | RECOMMENDED,  // Kore
1247             0x11083 | EXCLUSION,  // Kthi
1248             0x10AD8 | EXCLUSION | RTL,  // Mani
1249             0x10B60 | EXCLUSION | RTL,  // Phli
1250             0x10B8F | EXCLUSION | RTL,  // Phlp
1251             0,
1252             0x10B40 | EXCLUSION | RTL,  // Prti
1253             0x0800 | EXCLUSION | RTL,  // Samr
1254             0xAA80 | LIMITED_USE | LB_LETTERS,  // Tavt
1255             0,
1256             0,
1257             0xA6A0 | LIMITED_USE,  // Bamu
1258             0xA4D0 | LIMITED_USE,  // Lisu
1259             0,
1260             0x10A60 | EXCLUSION | RTL,  // Sarb
1261             0x16AE6 | EXCLUSION,  // Bass
1262             0x1BC20 | EXCLUSION,  // Dupl
1263             0x10500 | EXCLUSION,  // Elba
1264             0x11315 | EXCLUSION,  // Gran
1265             0,
1266             0,
1267             0x1E802 | EXCLUSION | RTL,  // Mend
1268             0x109A0 | EXCLUSION | RTL,  // Merc
1269             0x10A95 | EXCLUSION | RTL,  // Narb
1270             0x10896 | EXCLUSION | RTL,  // Nbat
1271             0x10873 | EXCLUSION | RTL,  // Palm
1272             0x112BE | EXCLUSION,  // Sind
1273             0x118B4 | EXCLUSION | CASED,  // Wara
1274             0,
1275             0,
1276             0x16A4F | EXCLUSION,  // Mroo
1277             0x1B1C4 | EXCLUSION | LB_LETTERS,  // Nshu
1278             0x11183 | EXCLUSION,  // Shrd
1279             0x110D0 | EXCLUSION,  // Sora
1280             0x11680 | EXCLUSION,  // Takr
1281             0x18229 | EXCLUSION | LB_LETTERS,  // Tang
1282             0,
1283             0x14400 | EXCLUSION,  // Hluw
1284             0x11208 | EXCLUSION,  // Khoj
1285             0x11484 | EXCLUSION,  // Tirh
1286             0x10537 | EXCLUSION,  // Aghb
1287             0x11152 | EXCLUSION,  // Mahj
1288             0x11717 | EXCLUSION | LB_LETTERS,  // Ahom
1289             0x108F4 | EXCLUSION | RTL,  // Hatr
1290             0x1160E | EXCLUSION,  // Modi
1291             0x1128F | EXCLUSION,  // Mult
1292             0x11AC0 | EXCLUSION,  // Pauc
1293             0x1158E | EXCLUSION,  // Sidd
1294             0x1E909 | LIMITED_USE | RTL | CASED,  // Adlm
1295             0x11C0E | EXCLUSION,  // Bhks
1296             0x11C72 | EXCLUSION,  // Marc
1297             0x11412 | LIMITED_USE,  // Newa
1298             0x104B5 | LIMITED_USE | CASED,  // Osge
1299             0x5B57 | RECOMMENDED | LB_LETTERS,  // Hanb
1300             0x1112 | RECOMMENDED,  // Jamo
1301             0,
1302             0x11D10 | EXCLUSION,  // Gonm
1303             0x11A5C | EXCLUSION,  // Soyo
1304             0x11A0B | EXCLUSION,  // Zanb
1305             0x1180B | EXCLUSION,  // Dogr
1306             0x11D71 | LIMITED_USE,  // Gong
1307             0x11EE5 | EXCLUSION,  // Maka
1308             0x16E40 | EXCLUSION | CASED,  // Medf
1309             0x10D12 | LIMITED_USE | RTL,  // Rohg
1310             0x10F42 | EXCLUSION | RTL,  // Sogd
1311             0x10F19 | EXCLUSION | RTL,  // Sogo
1312             // End copy-paste from parsescriptmetadata.py
1313         };
1314 
getScriptProps(int script)1315         private static final int getScriptProps(int script) {
1316             if (0 <= script && script < SCRIPT_PROPS.length) {
1317                 return SCRIPT_PROPS[script];
1318             } else {
1319                 return 0;
1320             }
1321         }
1322     }
1323 
1324     /**
1325      * Script usage constants.
1326      * See UAX #31 Unicode Identifier and Pattern Syntax.
1327      * http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers
1328      */
1329     public enum ScriptUsage {
1330         /**
1331          * Not encoded in Unicode.
1332          */
1333         NOT_ENCODED,
1334         /**
1335          * Unknown script usage.
1336          */
1337         UNKNOWN,
1338         /**
1339          * Candidate for Exclusion from Identifiers.
1340          */
1341         EXCLUDED,
1342         /**
1343          * Limited Use script.
1344          */
1345         LIMITED_USE,
1346         /**
1347          * Aspirational Use script.
1348          */
1349         ASPIRATIONAL,
1350         /**
1351          * Recommended script.
1352          */
1353         RECOMMENDED
1354     }
1355     private static final ScriptUsage[] usageValues = ScriptUsage.values();
1356 
1357     /**
1358      * Returns the script sample character string.
1359      * This string normally consists of one code point but might be longer.
1360      * The string is empty if the script is not encoded.
1361      *
1362      * @param script script code
1363      * @return the sample character string
1364      */
getSampleString(int script)1365     public static final String getSampleString(int script) {
1366         int sampleChar = ScriptMetadata.getScriptProps(script) & 0x1fffff;
1367         if(sampleChar != 0) {
1368             return new StringBuilder().appendCodePoint(sampleChar).toString();
1369         }
1370         return "";
1371     }
1372 
1373     /**
1374      * Returns the script usage according to UAX #31 Unicode Identifier and Pattern Syntax.
1375      * Returns {@link ScriptUsage#NOT_ENCODED} if the script is not encoded in Unicode.
1376      *
1377      * @param script script code
1378      * @return script usage
1379      * @see ScriptUsage
1380      */
getUsage(int script)1381     public static final ScriptUsage getUsage(int script) {
1382         return usageValues[(ScriptMetadata.getScriptProps(script) >> 21) & 7];
1383     }
1384 
1385     /**
1386      * Returns true if the script is written right-to-left.
1387      * For example, Arab and Hebr.
1388      *
1389      * @param script script code
1390      * @return true if the script is right-to-left
1391      */
isRightToLeft(int script)1392     public static final boolean isRightToLeft(int script) {
1393         return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.RTL) != 0;
1394     }
1395 
1396     /**
1397      * Returns true if the script allows line breaks between letters (excluding hyphenation).
1398      * Such a script typically requires dictionary-based line breaking.
1399      * For example, Hani and Thai.
1400      *
1401      * @param script script code
1402      * @return true if the script allows line breaks between letters
1403      */
breaksBetweenLetters(int script)1404     public static final boolean breaksBetweenLetters(int script) {
1405         return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.LB_LETTERS) != 0;
1406     }
1407 
1408     /**
1409      * Returns true if in modern (or most recent) usage of the script case distinctions are customary.
1410      * For example, Latn and Cyrl.
1411      *
1412      * @param script script code
1413      * @return true if the script is cased
1414      */
isCased(int script)1415     public static final boolean isCased(int script) {
1416         return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.CASED) != 0;
1417     }
1418 
1419     ///CLOVER:OFF
1420     /**
1421      *  Private Constructor. Never default construct
1422      */
UScript()1423     private UScript(){}
1424     ///CLOVER:ON
1425 }
1426