示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Determines whether or not to load the specified character in the grid. This method
        /// is only used when the grid is being loaded from a font.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private bool ShouldLoadFontChar(char ch)
        {
            if (ch == StringUtils.kchObject || ch == StringUtils.kchReplacement)
            {
                return(false);
            }

            if (m_cpe == null)
            {
                return((m_fSymbolCharSet || !char.IsLetterOrDigit(ch)) &&
                       !char.IsWhiteSpace(ch) && !char.IsControl(ch));
            }

            UcdProperty ucdProp = UcdProperty.GetInstance(m_cpe.get_GeneralCategory(ch));
            string      sUcdRep = ucdProp.UcdRepresentation;

            if (string.IsNullOrEmpty(sUcdRep))
            {
                return(false);
            }

            char charCat = sUcdRep.ToUpperInvariant()[0];

            return(charCat == 'S' || charCat == 'P' ||
                   (m_fSymbolCharSet && (charCat == 'L' || charCat == 'N')));
        }
示例#2
0
		/// <summary>
		/// Copy data from the given PUACharacter
		/// </summary>
		/// <param name="sourcePuaChar">The character to copy.</param>
		public void Copy(PUACharacter sourcePuaChar)
		{
			this.CodePoint = sourcePuaChar.m_codepoint;
			this.Name = sourcePuaChar.m_name;
			this.m_generalCategory = sourcePuaChar.m_generalCategory;
			this.m_canonicalCombiningClass = sourcePuaChar.m_canonicalCombiningClass;
			this.m_bidiClass = sourcePuaChar.m_bidiClass;
			this.m_decompositionType = sourcePuaChar.m_decompositionType;
			this.m_decomposition = sourcePuaChar.m_decomposition;
			this.m_numericType = sourcePuaChar.m_numericType;
			this.m_numericValue = sourcePuaChar.m_numericValue;
			this.m_bidiMirrored = sourcePuaChar.m_bidiMirrored;
			this.m_unicode1Name = sourcePuaChar.m_unicode1Name;
			this.m_isoComment = sourcePuaChar.m_isoComment;
			this.m_upper = sourcePuaChar.m_upper;
			this.m_lower = sourcePuaChar.m_lower;
			this.m_title = sourcePuaChar.m_title;
		}
示例#3
0
		/// <summary>
		/// Update this PUA character to match the codepoint in ICU.
		/// </summary>
		/// <returns>Whether the character was completely loaded from Icu.</returns>
		public bool RefreshFromIcu(bool loadBlankNames)
		{
			InitTheCom();

			// use the codepoint
			int parsedCodepoint = (int)Character;
			if(!IsInRange(m_codepoint, m_validCodepointRanges))
				return false;

			// set the name
			Icu.UErrorCode error;
			Icu.UCharNameChoice choice = Icu.UCharNameChoice.U_UNICODE_CHAR_NAME;
			int len = Icu.u_CharName(parsedCodepoint, choice, out m_name, out error);

			// Don't load blank names, unless requested to.
			if(!loadBlankNames && m_name.Length <= 0)
				return false;

			// Set several properties
			m_generalCategory =
				UcdProperty.GetInstance(s_charPropEngine.get_GeneralCategory(parsedCodepoint));
			m_canonicalCombiningClass =
				UcdProperty.GetInstance(s_charPropEngine.get_CombiningClass(parsedCodepoint));
			m_bidiClass =UcdProperty.GetInstance(s_charPropEngine.get_BidiCategory(parsedCodepoint));

			m_decomposition = ConvertToHexString(s_charPropEngine.get_Decomposition(parsedCodepoint));
			m_decompositionType = Icu.GetDecompositionType(parsedCodepoint);�
			m_numericType = Icu.GetNumericType(parsedCodepoint);
			if( m_numericType != UcdProperty.GetInstance(Icu.UNumericType.U_NT_NONE) )
				m_numericValue = decimalToFraction(Icu.u_GetNumericValue(parsedCodepoint));
			else
				m_numericValue = "";

			// Set the bidi mirrored
			BidiMirrored = Icu.u_IsMirrored(parsedCodepoint);

			// Set upper, lower, and title
			m_upper = PUACharacter.ConvertToHexString(s_charPropEngine.get_ToUpperCh(parsedCodepoint));
			m_lower = PUACharacter.ConvertToHexString(s_charPropEngine.get_ToLowerCh(parsedCodepoint));
			m_title = PUACharacter.ConvertToHexString(s_charPropEngine.get_ToTitleCh(parsedCodepoint));

			// We don't have to do the following (if they already exist, we may delete the values)
			//unicode1Name
			m_isoComment = s_charPropEngine.get_Comment(parsedCodepoint);

			return true;
		}
			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Changes the comboBox associated with the given unicode property
			/// </summary>
			/// <param name="unicodePropertyIndex">The index of the Unicode property as listed in:
			/// http://www.unicode.org/Public/UNIDATA/UCD.html</param>
			/// <param name="selectValue">The value to select</param>
			/// --------------------------------------------------------------------------------
			protected void SelectInComboBox(int unicodePropertyIndex, UcdProperty selectValue)
			{
				ComboBox comboBox;
				switch (unicodePropertyIndex)
				{
					case 2:
						comboBox = m_cbGeneralCategory;
						break;
					case 3:
						comboBox = m_cbCanonicalCombClass;
						break;
					case 4:
						comboBox = m_cbBidiClass;
						break;
					case 5:
						comboBox = m_cbCompatabilityDecomposition;
						break;
					case 6:
					case 7:
					case 8:
						comboBox = m_cbNumericType;
						break;
					default:
						// Don't attempt to continue if the associated Control isn't a TextBox.
						return;
				}
				// Don't allow the "test" user to edit disabled boxes.
				if (comboBox.Enabled == false)
					return;

				comboBox.SelectedItem = selectValue;
			}