예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Builds the content of the tool tip.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void BuildToolTipContent(string chr)
        {
            m_text = (chr.Length == 1 ?
                      Properties.Resources.kstidChrGridCodepoint :
                      Properties.Resources.kstidChrGridCodepoints);

            // Get the string containing the character codepoints.
            m_text = string.Format(m_text, chr.CharacterCodepoints());

            if (UnicodeValueTextConstructed != null)
            {
                UnicodeValueTextConstructed(this, m_ctrl, ref m_text);
            }

            string name = Icu.GetPrettyICUCharName(chr);

            // Get the name of the character if its length is 1.
            if (!string.IsNullOrEmpty(name))
            {
                name    = string.Format(Properties.Resources.kstidChrGridName, name);
                m_text += (Environment.NewLine + name);
            }

            m_showMissingGlyphIcon = !Win32.AreCharGlyphsInFont(chr, m_fntChar);

            // If the glyphs for the codepoints are not present in the character
            // grid's font, then use a heading telling the user that.
            ToolTipTitle = (m_showMissingGlyphIcon ?
                            Properties.Resources.kstidChrGridMissingGlyphHdg :
                            Properties.Resources.kstidChrGridNormalHdg);
        }
예제 #2
0
        private static void VerifyNonexistentChars()
        {
            Icu.InitIcuDataDir();

            Assert.IsFalse(Icu.IsAlphabetic(kChar1));
            Assert.IsFalse(Icu.IsAlphabetic(kChar2));
            Assert.IsFalse(Icu.IsAlphabetic(kChar3));
            Assert.IsFalse(Icu.IsAlphabetic(kChar4));
            Assert.IsFalse(Icu.IsControl(kChar1));
            Assert.IsFalse(Icu.IsControl(kChar2));
            Assert.IsFalse(Icu.IsControl(kChar3));
            Assert.IsFalse(Icu.IsControl(kChar4));
            Assert.IsFalse(Icu.IsDiacritic(kChar1));
            Assert.IsFalse(Icu.IsDiacritic(kChar2));
            Assert.IsFalse(Icu.IsDiacritic(kChar3));
            Assert.IsFalse(Icu.IsDiacritic(kChar4));
            Assert.IsFalse(Icu.IsIdeographic(kChar1));
            Assert.IsFalse(Icu.IsIdeographic(kChar2));
            Assert.IsFalse(Icu.IsIdeographic(kChar3));
            Assert.IsFalse(Icu.IsIdeographic(kChar4));
            Assert.IsFalse(Icu.IsNumeric(kChar1));
            Assert.IsFalse(Icu.IsNumeric(kChar2));
            Assert.IsFalse(Icu.IsNumeric(kChar3));
            Assert.IsFalse(Icu.IsNumeric(kChar4));
            Assert.IsFalse(Icu.IsPunct(kChar1));
            Assert.IsFalse(Icu.IsPunct(kChar2));
            Assert.IsFalse(Icu.IsPunct(kChar3));
            Assert.IsFalse(Icu.IsPunct(kChar4));
            Assert.IsFalse(Icu.IsSpace(kChar1));
            Assert.IsFalse(Icu.IsSpace(kChar2));
            Assert.IsFalse(Icu.IsSpace(kChar3));
            Assert.IsFalse(Icu.IsSpace(kChar4));
            Assert.IsFalse(Icu.IsSymbol(kChar1));
            Assert.IsFalse(Icu.IsSymbol(kChar2));
            Assert.IsFalse(Icu.IsSymbol(kChar3));
            Assert.IsFalse(Icu.IsSymbol(kChar4));

            Assert.AreEqual(Icu.UCharCategory.U_PRIVATE_USE_CHAR, Icu.GetCharType(kChar1));
            Assert.AreEqual(Icu.UCharCategory.U_PRIVATE_USE_CHAR, Icu.GetCharType(kChar2));
            Assert.AreEqual(Icu.UCharCategory.U_UNASSIGNED, Icu.GetCharType(kChar3));
            Assert.AreEqual(Icu.UCharCategory.U_UNASSIGNED, Icu.GetCharType(kChar4));
            var decompositionType = Icu.GetDecompositionType(kChar1);

            Assert.AreEqual("[none]", decompositionType.Description);
            decompositionType = Icu.GetDecompositionType(kChar2);
            Assert.AreEqual("[none]", decompositionType.Description);
            decompositionType = Icu.GetDecompositionType(kChar3);
            Assert.AreEqual("[none]", decompositionType.Description);
            decompositionType = Icu.GetDecompositionType(kChar4);
            Assert.AreEqual("[none]", decompositionType.Description);
            var numericType = Icu.GetNumericType(kChar1);

            Assert.AreEqual("[none]", numericType.Description);
            numericType = Icu.GetNumericType(kChar2);
            Assert.AreEqual("[none]", numericType.Description);
            numericType = Icu.GetNumericType(kChar3);
            Assert.AreEqual("[none]", numericType.Description);
            numericType = Icu.GetNumericType(kChar4);
            Assert.AreEqual("[none]", numericType.Description);
            var prettyName = Icu.GetPrettyICUCharName("\xE000");

            Assert.IsNull(prettyName);
            prettyName = Icu.GetPrettyICUCharName("\xE001");
            Assert.IsNull(prettyName);
            prettyName = Icu.GetPrettyICUCharName(kChar3S);
            Assert.IsNull(prettyName);
            prettyName = Icu.GetPrettyICUCharName("\xDDDDD");
            Assert.IsNull(prettyName);
        }