本文整理汇总了C#中Paragraph.RecalculateCharactersEmbeddingLevels方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.RecalculateCharactersEmbeddingLevels方法的具体用法?C# Paragraph.RecalculateCharactersEmbeddingLevels怎么用?C# Paragraph.RecalculateCharactersEmbeddingLevels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paragraph
的用法示例。
在下文中一共展示了Paragraph.RecalculateCharactersEmbeddingLevels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SplitStringToParagraphs
// 3.3.1.P1 - Split the text into separate paragraphs.
// A paragraph separator is kept with the previous paragraph.
// Within each paragraph, apply all the other rules of this algorithm.
private static Paragraph[] SplitStringToParagraphs(string logicalString) {
List<Paragraph> ret = new List<Paragraph>();
int start = 0;
int i;
byte embedingLevel = 255;
for (i = 0; i < logicalString.Length; ++i) {
char c = logicalString[i];
BidiCharacterType cType = UnicodeCharacterDataResolver.GetBidiCharacterType(c);
if (cType == BidiCharacterType.B) {
Paragraph p = new Paragraph(logicalString.Substring(start, i - start));
p.ParagraphSeparator = c;
if (embedingLevel == 255)
embedingLevel = p.EmbeddingLevel;
else {
p.EmbeddingLevel = embedingLevel;
p.RecalculateCharactersEmbeddingLevels();
}
ret.Add(p);
start = i + 1;
}
}
if (i - start + 1 > 0) // string ended without a paragraph separator
{
ret.Add(new Paragraph(logicalString.Substring(start)));
}
return ret.ToArray();
}