本文整理汇总了C#中ITsString.get_IsNormalizedForm方法的典型用法代码示例。如果您正苦于以下问题:C# ITsString.get_IsNormalizedForm方法的具体用法?C# ITsString.get_IsNormalizedForm怎么用?C# ITsString.get_IsNormalizedForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsString
的用法示例。
在下文中一共展示了ITsString.get_IsNormalizedForm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunIsCorrect
/// ------------------------------------------------------------------------------------
/// <summary>
/// Verifies that the given run of the given ITsString contains the specified text and
/// properties.
/// </summary>
/// <param name="tss">The ITsString to test</param>
/// <param name="iRun">Zero-based run index to check</param>
/// <param name="expectedText">Expected contents of run</param>
/// <param name="expectedCharStyle">Expected character style name, or null if expecting
/// default paragraph character props</param>
/// <param name="expectedWs">Expected writing system for the run</param>
/// <param name="fExpectNFD">Pass <c>true</c> to make sure that TSS is in normal
/// form decomposed (which it probably should be if it has been saved to the DB); pass
/// <c>false</c> if the string is not expected to be decomposed.</param>
/// ------------------------------------------------------------------------------------
public static void RunIsCorrect(ITsString tss, int iRun, string expectedText,
string expectedCharStyle, int expectedWs, bool fExpectNFD)
{
Assert.AreEqual(fExpectNFD,
tss.get_IsNormalizedForm(FwNormalizationMode.knmNFD));
// If both strings are null then they're equal and there's nothing else to compare.
if (expectedText == null)
{
Assert.IsNull(tss.Text);
return;
}
// If both strings are 0-length, then they're equal; otherwise compare them.
if (expectedText.Length == 0)
Assert.AreEqual(0, tss.Length);
else
{
// compare strings
// apparently IndexOf performs Unicode normalization.
if (expectedText.IndexOf(tss.get_RunText(iRun), StringComparison.Ordinal) != 0)
{
Assert.Fail("Run " + iRun + " text differs. Expected <" +
expectedText + "> but was <" + tss.get_RunText(iRun) + ">");
}
}
ITsTextProps ttp1 = StyleUtils.CharStyleTextProps(expectedCharStyle, expectedWs);
ITsTextProps ttp2 = tss.get_Properties(iRun);
string sWhy;
if (!TsTextPropsHelper.PropsAreEqual(ttp1, ttp2, out sWhy))
Assert.Fail(sWhy);
}
示例2: NormalizeNfd
/// ------------------------------------------------------------------------------------
/// <summary>
/// Normalizes the specified TsString in NFD form.
/// </summary>
/// <param name="source">The TsString to normalize.</param>
/// <returns>The normalized TsString</returns>
/// ------------------------------------------------------------------------------------
public static ITsString NormalizeNfd(ITsString source)
{
if (source == null || source.Length == 0 || source.get_IsNormalizedForm(FwNormalizationMode.knmNFD))
{
return source;
// No need to normalize
}
return source.get_NormalizedForm(FwNormalizationMode.knmNFD);
}