示例#1
0
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://www.unicode.org/charts/PDF/UE000.pdf">Newline</a>
        /// </summary>
        public EudcProperty(UnicodeRangeDatabase unicodeDb, Collection<UnicodeRange> expectedRanges)
        {
            low = 0xE000; high = 0xF8FF;

            bool isValid = false;
            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    range,
                    eudcRangeList,
                    "Private Use",
                    GroupAttributes.GroupName))
                {
                    isValid = true;
                }
            }

            if(!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "EudcProperty, EUDC ranges are beyond expected range. " +
                    "Refer to Private Use range.");
            }
            
            foreach (UnicodeRangeProperty data in eudcRangeList)
            {
                if (data.Name.Equals("Private Use Area", StringComparison.OrdinalIgnoreCase))
                {
                    low = data.Range.StartOfUnicodeRange;
                    high = data.Range.EndOfUnicodeRange;
                    break;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Define CombiningMarksProperty class
        /// <a href="http://www.unicode.org/charts/PDF/U0300.pdf">Newline</a>
        /// <a href="http://www.unicode.org/charts/PDF/U1DC0.pdf">Newline</a>
        /// <a href="http://www.unicode.org/charts/PDF/UFE20.pdf">Newline</a>
        /// </summary>
        public CombiningMarksProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        combiningMarksPropertyRangeList,
                        "Combining Diacritics",
                        GroupAttributes.GroupName))
                {
                    isValid = true;
                }
            }

            if (InitializeCombiningMarksDictionary(expectedRanges))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "CombiningMarksProperty, Combining mark ranges are beyond expected range. " +
                                                      "Refer to Combining Diacritics range.");
            }
        }
示例#3
0
        /// <summary>
        /// Define CombiningMarksProperty class
        /// <a href="http://www.unicode.org/charts/PDF/U0300.pdf">Newline</a>
        /// <a href="http://www.unicode.org/charts/PDF/U1DC0.pdf">Newline</a>
        /// <a href="http://www.unicode.org/charts/PDF/UFE20.pdf">Newline</a>
        /// </summary>
        public CombiningMarksProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            bool isValid = false;

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    combiningMarksPropertyRangeList,
                    "Combining Diacritics",
                    GroupAttributes.GroupName))
            {
                isValid = true;
            }

            if (InitializeCombiningMarksDictionary(expectedRange))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("CombiningMarksProperty, combining mark ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) +
                                                      ". Refer to Combining Diacritics range.");
            }
        }
示例#4
0
        /// <summary>
        /// Define NumberProperty class,
        /// <a href="http://unicode.org/reports/tr13/tr13-5.html">Newline</a>
        /// </summary>
        public NumberProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            bool isValid = false;

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    numberDigitRangeList,
                    "Numbers and Digits",
                    GroupAttributes.GroupName))
            {
                isValid = true;
            }

            if (InitializeNumberCharDictionary(expectedRange))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("NumberProperty, number ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) +
                                                      ". Refer to latin numberals and point, percent, plus, and minus signs, and comma.");
            }
        }
示例#5
0
        /// <summary>
        /// Define NumberProperty class,
        /// <a href="http://unicode.org/reports/tr13/tr13-5.html">Newline</a>
        /// </summary>
        public NumberProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        numberDigitRangeList,
                        "Numbers and Digits",
                        GroupAttributes.GroupName))
                {
                    isValid = true;
                }
            }

            if (InitializeNumberCharDictionary(expectedRanges))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "NumberProperty, number ranges are beyond expected range. " +
                                                      "Refer to latin numberals and point, percent, plus, and minus signs, and comma.");
            }
        }
        /// <summary>
        /// Define LineBreakDictionary class,
        /// <a href="http://www.unicode.org/reports/tr29/">Newline</a>
        /// </summary>
        public TextSegmentationProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textSegmentationRangeList,
                        "Controls",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
            }

            if (InitializeDictionaries(expectedRanges))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "TextSegmentationProperty, " +
                                                      "code points for text segmentation ranges are beyond expected range. " + "Refert to Controls ranges");
            }
        }
        /// <summary>
        /// Define LineBreakDictionary class,
        /// <a href="http://www.unicode.org/reports/tr29/">Newline</a>
        /// </summary>
        public TextSegmentationProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            bool isValid = false;

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textSegmentationRangeList,
                    "Controls",
                    GroupAttributes.Name))
            {
                isValid = true;
            }

            if (InitializeDictionaries(expectedRange))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("TextSegmentationProperty, code points for text segmentation ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) + ". Refert to Controls ranges");
            }
        }
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://www.unicode.org/charts/PDF/UE000.pdf">Newline</a>
        /// </summary>
        public EudcProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            low = 0xE000; high = 0xF8FF;
            if (!RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    eudcRangeList,
                    "Private Use",
                    GroupAttributes.GroupName))
            {
                throw new ArgumentOutOfRangeException("EudcProperty, EUDC ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) + ". Refer to Private Use range.");
            }

            foreach (UnicodeRangeProperty data in eudcRangeList)
            {
                if (data.Name.Equals("Private Use Area", StringComparison.OrdinalIgnoreCase))
                {
                    low  = data.Range.StartOfUnicodeRange;
                    high = data.Range.EndOfUnicodeRange;
                    break;
                }
            }
        }
示例#9
0
        /// <summary>
        /// Define SurrogatePairProperty class
        /// <a href="http://www.unicode.org/charts/PDF/UD800.pdf">Newline</a>
        /// <a href="http://www.unicode.org/charts/PDF/UDC00.pdf">Newline</a>
        /// </summary>
        public SurrogatePairProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        surrogatePairRangeList,
                        "Surrogates",
                        GroupAttributes.GroupName))
                {
                    foreach (UnicodeRangeProperty data in surrogatePairRangeList)
                    {
                        if (data.Name.Equals("High Surrogates", StringComparison.OrdinalIgnoreCase))
                        {
                            highMin = data.Range.StartOfUnicodeRange;
                            highMax = data.Range.EndOfUnicodeRange;
                        }
                        else if (data.Name.Equals("Low Surrogates", StringComparison.OrdinalIgnoreCase))
                        {
                            lowMin = data.Range.StartOfUnicodeRange;
                            lowMax = data.Range.EndOfUnicodeRange;
                        }
                    }
                    isValid = true;
                }

                surrogateRange = RangePropertyCollector.GetRange(new UnicodeRange(0x10000, TextUtil.MaxUnicodePoint), range);
                if (null != surrogateRange)
                {
                    isValid = true;
                }
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "SurrogatePairProperty, SurrogatePair ranges are beyond expected range. " +
                                                      "Refert to Surrogates range and UTF32.");
            }
        }
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://unicode.org/reports/tr9/">Newline</a>
        /// </summary>
        public BidiProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        bidiPropertyRangeList,
                        "Arabic",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }

                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        bidiPropertyRangeList,
                        "Hebrew",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
            }

            if (InitializeBidiDictionary(expectedRanges))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "BidiProperty, Bidi ranges are beyond expected range. " +
                                                      "Refer to Arabic and Hebrew ranges.");
            }

            // Reset isValid to validate Latin range
            isValid = false;
            foreach (UnicodeRange expectedRange in expectedRanges)
            {
                UnicodeRange range = RangePropertyCollector.GetRange(new UnicodeRange(0x0030, 0x0039), expectedRange);
                if (null != range)
                {
                    latinRangeList.Add(range);
                    isValid = true;
                }

                range = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), expectedRange);
                if (null != range)
                {
                    latinRangeList.Add(range);
                    isValid = true;
                }

                range = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), expectedRange);
                if (null != range)
                {
                    latinRangeList.Add(range);
                    isValid = true;
                }
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "BidiProperty, Bidi ranges are beyond expected range. " +
                                                      "0x0030 - 0x0039,  0x0041 - 0x005A, and 0x0061 - 0x007A ranges are needed to construct Bidi string.");
            }
        }
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://www.unicode.org/reports/tr15/">Newline</a>
        /// <a href="http://www.unicode.org/charts/normalization/">Newline</a>
        /// </summary>
        public TextNormalizationProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges)
        {
            bool isValid = false;

            foreach (UnicodeRange range in expectedRanges)
            {
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Latin",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "CJK Unified Ideographs (Han)",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "CJK Compatibility Ideographs",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Katakana",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Hangul Jamo",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Hangul Syllables",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Arabic",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
                if (RangePropertyCollector.BuildPropertyDataList(
                        unicodeDb,
                        range,
                        textNormalizationRangeList,
                        "Greek",
                        GroupAttributes.Name))
                {
                    isValid = true;
                }
            }


            if (InitializeTextNormalizationPropertyDictionary(expectedRanges))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("expectedRanges", "TextNormalizationProperty, " +
                                                      "code points for text normalization ranges are beyond expected range. " + "Refert to Latin,  CJK Unified Ideographs (Han) " +
                                                      "CJK Compatibility Ideographs, Katakana, Hangul Jamo, Hangul Syllables, Arabic, and  Greek ranges.");
            }
        }
示例#12
0
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://unicode.org/reports/tr9/">Newline</a>
        /// </summary>
        public BidiProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            bool isValid = false;

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    bidiPropertyRangeList,
                    "Arabic",
                    GroupAttributes.Name))
            {
                isValid = true;
            }

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    bidiPropertyRangeList,
                    "Hebrew",
                    GroupAttributes.Name))
            {
                isValid = true;
            }

            if (InitializeBidiDictionary(expectedRange))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("BidiProperty, Bidi ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) +
                                                      ". Refer to Arabic and Hebrew ranges.");
            }

            UnicodeRange range = RangePropertyCollector.GetRange(new UnicodeRange(0x0030, 0x0039), expectedRange);

            if (null != range)
            {
                latinRangeList.Add(range);
                isValid = true;
            }

            range = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), expectedRange);
            if (null != range)
            {
                latinRangeList.Add(range);
                isValid = true;
            }

            range = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), expectedRange);
            if (null != range)
            {
                latinRangeList.Add(range);
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("BidiProperty, Bidi ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) +
                                                      ". 0x0030 - 0x0039,  0x0041 - 0x005A, and 0x0061 - 0x007A ranges are needed to construct Bidi string.");
            }
        }
        /// <summary>
        /// Define SurrogatePairDictionary class
        /// <a href="http://www.unicode.org/reports/tr15/">Newline</a>
        /// <a href="http://www.unicode.org/charts/normalization/">Newline</a>
        /// </summary>
        public TextNormalizationProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange)
        {
            bool isValid = false;

            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Latin",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "CJK Unified Ideographs (Han)",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "CJK Compatibility Ideographs",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Katakana",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Hangul Jamo",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Hangul Syllables",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Arabic",
                    GroupAttributes.Name))
            {
                isValid = true;
            }
            if (RangePropertyCollector.BuildPropertyDataList(
                    unicodeDb,
                    expectedRange,
                    textNormalizationRangeList,
                    "Greek",
                    GroupAttributes.Name))
            {
                isValid = true;
            }


            if (InitializeTextNormalizationPropertyDictionary(expectedRange))
            {
                isValid = true;
            }

            if (!isValid)
            {
                throw new ArgumentOutOfRangeException("TextNormalizationProperty, code points for text normalization ranges are beyond expected range, " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " +
                                                      String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) + ". Refert to Latin,  CJK Unified Ideographs (Han) " +
                                                      "CJK Compatibility Ideographs, Katakana, Hangul Jamo, Hangul Syllables, Arabic, and  Greek ranges.");
            }
        }