public void AddCharacter_DuplicateOfOverriddenWordFormingChar() { string sXml = ksXmlHeader + "<ValidCharacters><WordForming>a\uFFFC-</WordForming>" + "<Numeric/>" + "<Other>{</Other>" + "</ValidCharacters>"; ValidCharacters validChars = ValidCharacters.Load(sXml, "Test WS", null); ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars); Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(1, validCharsW.OtherCharacters.Count); Assert.IsTrue(validChars.IsWordForming("-")); Assert.IsFalse(validChars.IsWordForming("{")); validChars.AddCharacter("-"); Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a")); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("-")); Assert.IsTrue(validChars.IsWordForming("-")); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(1, validCharsW.OtherCharacters.Count); Assert.IsTrue(validCharsW.OtherCharacters.Contains("{")); Assert.IsFalse(validChars.IsWordForming("{")); }
public void IsWordFormingChar() { ValidCharacters validChars = ValidCharacters.Load(ksXmlHeader + "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC#</WordForming>" + "<Numeric></Numeric>" + "<Other></Other>" + "</ValidCharacters>", "Test WS", null); Assert.IsTrue(validChars.IsWordForming('#')); Assert.IsTrue(validChars.IsWordForming("#")); }
private void EnsureQuoteAndHyphenWordForming(CoreWritingSystemDefinition wsObj) { ValidCharacters validChars = ValidCharacters.Load(wsObj); var fChangedSomething = false; if (!validChars.IsWordForming('-')) { validChars.AddCharacter("-", ValidCharacterType.WordForming); fChangedSomething = true; } if (!validChars.IsWordForming('\'')) { validChars.AddCharacter("'", ValidCharacterType.WordForming); fChangedSomething = true; } if (!fChangedSomething) { return; } validChars.SaveTo(wsObj); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines whether a character is a word forming character. /// </summary> /// <param name="cc">The specified character.</param> /// <returns> /// <c>true</c> if the character is a word forming character; otherwise, <c>false</c>. /// </returns> /// ------------------------------------------------------------------------------------ public override bool IsWordFormingCharacter(char cc) { return(m_validChars.IsWordForming(cc)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines whether a character is a word forming character. /// </summary> /// <param name="cc">The specified character.</param> /// <returns> /// <c>true</c> if the character is a word forming character; otherwise, <c>false</c>. /// </returns> /// ------------------------------------------------------------------------------------ public override bool IsWordFormingCharacter(char cc) { return(m_validChars != null?m_validChars.IsWordForming(cc) : TsStringUtils.IsWordForming(cc)); }