本文整理汇总了C#中ITsString.get_RunText方法的典型用法代码示例。如果您正苦于以下问题:C# ITsString.get_RunText方法的具体用法?C# ITsString.get_RunText怎么用?C# ITsString.get_RunText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsString
的用法示例。
在下文中一共展示了ITsString.get_RunText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = TsPropsFactoryClass.Create().MakeProps(expectedCharStyle, expectedWs, 0);
ITsTextProps ttp2 = tss.get_Properties(iRun);
string sWhy;
if (!TsTextPropsHelper.PropsAreEqual(ttp1, ttp2, out sWhy))
Assert.Fail(sWhy);
}
示例2: WriteFieldWorksTsStringContent
private void WriteFieldWorksTsStringContent(ITsString tssVal, XmlWriter writer)
{
int crun = tssVal.RunCount;
int nVar;
int tpt;
int nProp;
string sProp;
for (int irun = 0; irun < crun; ++irun)
{
StringBuilder sbComment = new StringBuilder();
writer.WriteStartElement("run");
ITsTextProps ttp = tssVal.get_Properties(irun);
int cprop = ttp.IntPropCount;
for (int iprop = 0; iprop < cprop; ++iprop)
{
nProp = ttp.GetIntProp(iprop, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs)
{
string sLang = m_cache.WritingSystemFactory.GetStrFromWs(nProp);
writer.WriteAttributeString("ws", sLang);
}
else
{
AddIntPropToBuilder(tpt, nProp, nVar, sbComment);
}
}
cprop = ttp.StrPropCount;
for (int iprop = 0; iprop < cprop; ++iprop)
{
sProp = ttp.GetStrProp(iprop, out tpt);
if (tpt == (int)FwTextPropType.ktptNamedStyle)
writer.WriteAttributeString("namedStyle", sProp);
else
AddStrPropToBuilder(tpt, sProp, sbComment);
}
if (sbComment.Length > 0)
writer.WriteComment(sbComment.ToString());
string sRun = tssVal.get_RunText(irun);
writer.WriteString(Icu.Normalize(sRun, m_eIcuNormalizationMode));
writer.WriteEndElement();
}
}
示例3: GetGuidFromRun
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get a Guid from the given run in a structured text string.
/// </summary>
/// <param name="tss">given structured text string</param>
/// <param name="iRun">given run</param>
/// <param name="odt">object data type, 0 if no ORC guid located</param>
/// <param name="tri">run information</param>
/// <param name="ttp">text properties of the run (if incoming value is null and the
/// run is an object, this will be set to the run props)</param>
/// <param name="desiredOrcTypes">The desired ORC types, or null to return any type of
/// ORC</param>
/// <returns>
/// The GUID associated with the specified run of the tss, if any; otherwise Guid.Empty
/// </returns>
/// ------------------------------------------------------------------------------------
private static Guid GetGuidFromRun(ITsString tss, int iRun, FwObjDataTypes[] desiredOrcTypes, out FwObjDataTypes odt, out TsRunInfo tri, ref ITsTextProps ttp)
{
tss.FetchRunInfo(iRun, out tri);
if (tri.ichLim - tri.ichMin == 1 && tss.get_RunText(iRun)[0] == StringUtils.kChObject)
{
// determine if single-character run contains an ORC
ttp = ttp ?? tss.get_Properties(iRun);
return GetGuidFromProps(ttp, desiredOrcTypes, out odt);
}
odt = 0;
return Guid.Empty;
}
示例4: GetCleanTsString
/// ------------------------------------------------------------------------------------
/// <summary>
/// Gets a TsString with no: 1) ORCs (except maybe unknown ones, if so requested),
/// 3) clipboard-style footnote runs, or 4) runs having the specified character styles.
/// Also, leading and trailing spaces are removed if requested.
/// </summary>
/// <param name="tss">structured text string to clean up</param>
/// <param name="stylesToRemove">List of styles to remove (null if no styles should be
/// removed).</param>
/// <param name="fStopOnRemovedStyle">if set to <c>true</c> stop building the string
/// when a style to remove is encountered and we have some text in the string;
/// <c>false</c> to just skip stylesToRemove.</param>
/// <param name="fPreserveUnknownOrcs"><c>true</c> to allow the returned string to
/// contain ORC characters not associated with a special run.</param>
/// <param name="fTrimSpaces">if set to <c>true</c> leading and trailing spaces are
/// trimmed.</param>
/// ------------------------------------------------------------------------------------
public static ITsString GetCleanTsString(ITsString tss, IEnumerable<string> stylesToRemove, bool fStopOnRemovedStyle, bool fPreserveUnknownOrcs, bool fTrimSpaces)
{
if (tss == null)
return tss;
ITsStrBldr tssBldr = TsStrBldrClass.Create();
for (int iRun = 0; iRun < tss.RunCount; iRun++)
{
string runText = tss.get_RunText(iRun);
// skip empty runs
if (string.IsNullOrEmpty(runText))
continue;
// If run is an ORC, or a footnote, then skip it
if (runText[0] == StringUtils.kChObject)
{
if (!fPreserveUnknownOrcs)
continue;
if (GetGuidFromRun(tss, iRun) != Guid.Empty)
continue;
}
// Look for a footnote or picture run encoded with special formatting as
// would be the case if this TsString came from a selection.
ITsTextProps runProps = tss.get_Properties(iRun);
if (!string.IsNullOrEmpty(runProps.ObjData()))
continue;
// Check for removed styles.
if (stylesToRemove != null && stylesToRemove.Contains(runProps.Style()))
{
if (fStopOnRemovedStyle && tssBldr.Length > 0)
break;
continue;
}
// Trim the run, if needed
if (fTrimSpaces)
{
if (iRun == 0)
runText = runText.TrimStart();
if (iRun == tss.RunCount - 1)
runText = runText.TrimEnd();
}
// Append the text to the accumulated ITsString
tssBldr.Replace(tssBldr.Length, tssBldr.Length, runText, runProps);
}
if (tssBldr.Length == 0)
{
// need to check for possibility of magic WS values - these are used for
// added text like newline characters.
if (GetWsOfRun(tss, 0) > 0)
tssBldr.SetProperties(0, 0, PropsForWs(GetWsOfRun(tss, 0)));
else
return null;
}
return tssBldr.GetString();
}
示例5: ConvertCVNumbersInStringForBT
/// ------------------------------------------------------------------------------------
/// <summary>
/// Return a TsString in which any CV numbers have been replaced by their BT equivalents
/// (in the specified writing system). Other properties, including style, are copied
/// from the input numbers.
/// </summary>
/// <param name="input">The input.</param>
/// <param name="wsTrans">The ws trans.</param>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
public ITsString ConvertCVNumbersInStringForBT(ITsString input, int wsTrans)
{
ITsStrBldr bldr = null;
// reverse order so we don't mess up offsets if new numbers differ in length.
for (int iRun = input.RunCount - 1; iRun >= 0; iRun--)
{
string styleName = input.get_Properties(iRun).GetStrPropValue(
(int)FwTextPropType.ktptNamedStyle);
if (styleName == ScrStyleNames.ChapterNumber ||
styleName == ScrStyleNames.VerseNumber)
{
string number = ConvertVerseChapterNumForBT(input.get_RunText(iRun));
if (number == null)
continue; // pathologically an empty string has verse number style??
if (bldr == null)
bldr = input.GetBldr(); // we have an actual change.
int ichMin, ichLim;
input.GetBoundsOfRun(iRun, out ichMin, out ichLim);
bldr.SetIntPropValues(ichMin, ichLim, (int)FwTextPropType.ktptWs,
(int)FwTextPropVar.ktpvDefault, wsTrans);
bldr.Replace(ichMin, ichLim, number, null);
}
}
if (bldr != null)
return bldr.GetString();
return input;
}
示例6: TsStringRunInfo
/// ------------------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="T:TsStringRunInfo"/> class.
/// </summary>
/// ------------------------------------------------------------------------------------
public TsStringRunInfo(int irun, ITsString tss, FdoCache cache)
{
Text = "\"" + (tss.get_RunText(irun) ?? string.Empty) + "\"";
TextProps = new TextProps(irun, tss, cache);
}
示例7: GetNextVerseNumberRun
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get the text of the next verse number run in a given ITsString after the given
/// character position.
/// </summary>
/// <param name="tss">the given ITsString</param>
/// <param name="ich">the given character position</param>
/// <param name="sChapterNumberRun">the string of a chapter number run,
/// if one was found just before the verse number we found; else null</param>
/// <returns>the string of the next verse number after the given ich, or null if not
/// found</returns>
/// ------------------------------------------------------------------------------------
private string GetNextVerseNumberRun(ITsString tss, int ich,
out string sChapterNumberRun)
{
sChapterNumberRun = null;
if (tss.Text == null)
return null;
TsRunInfo tsi;
ITsTextProps ttpRun;
while (ich < tss.Length)
{
// Get props of current run.
ttpRun = tss.FetchRunInfoAt(ich, out tsi);
// See if run is our verse number style.
if (StStyle.IsStyle(ttpRun, ScrStyleNames.VerseNumber))
{
// The whole run is the verse number. Extract it.
string sVerseNumberRun = tss.get_RunText(tsi.irun);
// Also extract a preceeding chapter number run, if present.
if (tsi.ichMin > 0)
{
// Get props of previous run.
ttpRun = tss.FetchRunInfoAt(tsi.ichMin - 1, out tsi);
// See if run is chapter number style; get its text.
if (StStyle.IsStyle(ttpRun, ScrStyleNames.ChapterNumber))
sChapterNumberRun = tss.get_RunText(tsi.irun);
}
return sVerseNumberRun;
}
// if this is a chapter number, check the next run to see if it is a
// verse number (perhaps it is implied).
if (StStyle.IsStyle(ttpRun, ScrStyleNames.ChapterNumber) &&
tsi.irun < tss.RunCount - 1)
{
ITsTextProps ttpNextRun = tss.get_Properties(tsi.irun + 1);
if (!StStyle.IsStyle(ttpNextRun, ScrStyleNames.VerseNumber))
{
// verse 1 is implied; get the chapter number
sChapterNumberRun = tss.get_RunText(tsi.irun);
return null;
}
}
ich = tsi.ichLim; // get ready for next run
}
// no verse number found
return null;
}
示例8: RemoveOutOfRangeChapterRun
/// ------------------------------------------------------------------------------------
/// <summary>
/// Remove the current chapter run if it is not within the specified reference range.
/// </summary>
/// <param name="iRun">run index</param>
/// <param name="hvoObj">the id of the paragraph of translation being modified</param>
/// <param name="wsAlt">the writing system, if a back translation the multiString alt</param>
/// <param name="startRef">minimum reference allowed in tss</param>
/// <param name="endRef">maximum reference allowed in tss</param>
/// <param name="tss">ref: given structured string from which out of range chapters will
/// be removed</param>
/// <returns>true if chapter number run removed, otherwise false</returns>
/// <remarks>If the specified run is not a chapter run, it will not be removed.</remarks>
/// ------------------------------------------------------------------------------------
private bool RemoveOutOfRangeChapterRun(int iRun, int hvoObj, int wsAlt,
BCVRef startRef, BCVRef endRef, ref ITsString tss)
{
Debug.Assert(iRun >= 0 && iRun < tss.RunCount, "Out of range run index");
ITsTextProps ttp = tss.get_Properties(iRun);
// Is run is a chapter number?
if (ttp.GetStrPropValue((int)FwTextPropType.ktptNamedStyle) ==
ScrStyleNames.ChapterNumber)
{
string runText = tss.get_RunText(iRun);
int chapterNum = ScrReference.ChapterToInt(runText);
if (chapterNum < startRef.Chapter || chapterNum > endRef.Chapter)
{
// chapter number is out of range. Remove!
int dummy;
int cchDel= runText.Length;
int ich = tss.get_MinOfRun(iRun);
ReplaceInParaOrBt(hvoObj, (int)CmTranslation.CmTranslationTags.kflidTranslation,
wsAlt, null, null, ich, ich + cchDel, ref tss, out dummy);
return true;
}
}
return false;
}
示例9: CheckFinalSpaceInReferenceLabel
/// ------------------------------------------------------------------------------------
/// <summary>
/// Checks the final space in reference label.
/// </summary>
/// ------------------------------------------------------------------------------------
private void CheckFinalSpaceInReferenceLabel(ITsString tss)
{
int iRun = tss.RunCount - 1;
Assert.AreEqual(" ", tss.get_RunText(iRun));
ITsTextProps ttp = tss.get_Properties(iRun);
Assert.AreEqual(null, ttp.GetStrPropValue((int)FwTextPropType.ktptNamedStyle));
int var;
Assert.AreEqual(Cache.DefaultUserWs,
ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var));
}
示例10: WriteTsStringContent
private void WriteTsStringContent(TextWriter w, ITsString tss)
{
for (var irun = 0; irun < tss.RunCount; ++irun)
{
var ttp = tss.get_Properties(irun);
int nvar;
var ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out nvar);
var sLang = m_cache.WritingSystemFactory.GetStrFromWs(ws);
var style = ttp.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
w.Write("<span lang=\"{0}\"", MakeSafeAndNormalizedAttribute(sLang));
if (!String.IsNullOrEmpty(style))
w.Write(" class=\"{0}\"", MakeSafeAndNormalizedAttribute(style));
w.Write(">{0}</span>", MakeSafeAndNormalizedXml(tss.get_RunText(irun)));
}
}
示例11: ConvertTsStringToLiftXml
private string ConvertTsStringToLiftXml(ITsString tssVal, int wsString)
{
var bldr = new StringBuilder();
var crun = tssVal.RunCount;
if (crun == 1)
{
if (IsVoiceWritingSystem(wsString))
{
// The alternative contains a file path or null. We need to adjust and export and copy the file.
// The whole content of the representation of the TsString will be the adjusted file name,
// since these WS alternatives never contain formatted data.
var internalPath = tssVal.Text == null ? "" : tssVal.Text;
// usually this will be unchanged, but it is pathologically possible that the file name conflicts.
var writePath = ExportFile(internalPath,
Path.Combine(FdoFileHelper.GetMediaDir(m_cache.LangProject.LinkedFilesRootDir), internalPath),
"audio");
return XmlUtils.MakeSafeXml(writePath);
}
}
for (var irun = 0; irun < crun; ++irun)
{
int tpt;
int nProp;
int nVar;
var ttp = tssVal.get_Properties(irun);
var fSpan = true;
if (ttp.IntPropCount == 1 && ttp.StrPropCount == 0)
{
nProp = ttp.GetIntProp(0, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs && nProp == wsString)
fSpan = false;
}
if (fSpan)
{
bldr.Append("<span");
var cprop = ttp.IntPropCount;
for (var iprop = 0; iprop < cprop; ++iprop)
{
nProp = ttp.GetIntProp(iprop, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs && nProp != wsString)
{
var ws = m_wsManager.Get(nProp);
bldr.AppendFormat(" lang=\"{0}\"", XmlUtils.MakeSafeXmlAttribute(ws.Id));
}
}
cprop = ttp.StrPropCount;
for (var iprop = 0; iprop < cprop; ++iprop)
{
var sProp = ttp.GetStrProp(iprop, out tpt);
switch (tpt)
{
case (int)FwTextPropType.ktptNamedStyle:
bldr.AppendFormat(" class=\"{0}\"", MakeSafeAndNormalizedAttribute(sProp));
break;
case (int)FwTextPropType.ktptObjData:
AddObjPropData(bldr, sProp);
break;
}
}
bldr.Append(">");
}
var sRun = tssVal.get_RunText(irun);
if (sRun != null)
{
bldr.Append(MakeSafeAndNormalizedXml(sRun.Replace("\x2028", Environment.NewLine)));
}
if (fSpan)
bldr.Append("</span>");
}
return bldr.ToString();
}
示例12: VerifyFootnoteMarkerOrcRun
/// ------------------------------------------------------------------------------------
/// <summary>
/// Tests that a footnote marker ORC (Object Replacement Character) has been inserted
/// as the iRunth run in the given TsString.
/// </summary>
/// <param name="tssPara">TsString to check</param>
/// <param name="iRun">Zero-based index of run to check for the ORC</param>
/// <param name="ws">Writing system that should be used for the ORC</param>
/// <param name="fBT">Indicates whether this is checking a back translation.</param>
/// ------------------------------------------------------------------------------------
public static void VerifyFootnoteMarkerOrcRun(ITsString tssPara, int iRun, int ws,
bool fBT)
{
Debug.Assert(tssPara.RunCount > iRun, "Trying to access run #" + iRun +
" when there are only " + tssPara.RunCount + " run(s).");
string sOrcRun = tssPara.get_RunText(iRun);
Assert.AreEqual(1, sOrcRun.Length);
Assert.AreEqual(StringUtils.kChObject, sOrcRun[0]);
ITsTextProps ttpOrcRun = tssPara.get_Properties(iRun);
int nDummy;
int wsActual = ttpOrcRun.GetIntPropValues((int)FwTextPropType.ktptWs,
out nDummy);
Assert.AreEqual(ws, wsActual, "Wrong writing system for footnote marker in text");
string objData = ttpOrcRun.GetStrPropValue((int)FwTextPropType.ktptObjData);
FwObjDataTypes orcType = (fBT) ? FwObjDataTypes.kodtNameGuidHot :
FwObjDataTypes.kodtOwnNameGuidHot;
Assert.AreEqual((char)(int)orcType, objData[0]);
}
示例13: ExportPictures
private void ExportPictures(ITsString tssPara)
{
int crun = tssPara.RunCount;
for (int i = 0; i < crun; ++i)
{
string runText = tssPara.get_RunText(i);
if (runText != null && runText.Length == 1 && runText[0] == StringUtils.kchObject)
{
ITsTextProps ttp = tssPara.get_Properties(i);
string objData = ttp.GetStrPropValue((int)FwTextPropType.ktptObjData);
if (!String.IsNullOrEmpty(objData) &&
objData[0] == (char)FwObjDataTypes.kodtGuidMoveableObjDisp)
{
Guid pictureGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
int hvoPicture = m_cache.GetIdFromGuid(pictureGuid);
if (hvoPicture != 0)
ExportPicture(new CmPicture(m_cache, hvoPicture));
}
}
}
}
示例14: WriteTsStringAsXml
/// <summary>
/// Write the ITsString out.
/// </summary>
/// <param name="tssPara"></param>
/// <param name="cchIndent"></param>
/// <remarks>TODO: this maybe should go into a generic method somewhere?
/// Except that part of it is specific to XHTML output...</remarks>
private void WriteTsStringAsXml(ITsString tssPara, int cchIndent)
{
// First, build the indentation.
StringBuilder bldr = new StringBuilder();
while (cchIndent > 0)
{
bldr.Append(" ");
--cchIndent;
}
string sIndent = bldr.ToString();
bldr.Append(" ");
string sIndent2 = bldr.ToString();
m_writer.WriteLine("{0}<Str>", sIndent);
int crun = tssPara.RunCount;
string sField = null;
for (int irun = 0; irun < crun; ++irun)
{
TsRunInfo tri;
ITsTextProps ttpRun = tssPara.FetchRunInfo(irun, out tri);
int ctip = ttpRun.IntPropCount;
int ctsp = ttpRun.StrPropCount;
string sFieldRun = ttpRun.GetStrPropValue((int)FwTextPropType.ktptFieldName);
if (sFieldRun != sField)
{
if (!String.IsNullOrEmpty(sField))
m_writer.WriteLine("{0}</Field>", sIndent2);
if (!String.IsNullOrEmpty(sFieldRun))
m_writer.WriteLine("{0}<Field name=\"{1}\">", sIndent2, sFieldRun);
sField = sFieldRun;
sFieldRun = null;
}
bool fMarkItem;
int tpt;
string sVal;
bool fSkipText = false;
int nVar;
int nVal = ttpRun.GetIntPropValues((int)FwTextPropType.ktptMarkItem, out nVar);
if (nVal == (int)FwTextToggleVal.kttvForceOn && nVar == (int)FwTextPropVar.ktpvEnum)
{
m_writer.Write("{0}<Item><Run", sIndent2);
fMarkItem = true;
}
else
{
m_writer.Write("{0}<Run", sIndent2);
fMarkItem = false;
}
for (int itip = 0; itip < ctip; ++itip)
{
nVal = ttpRun.GetIntProp(itip, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs || tpt == (int)FwTextPropType.ktptBaseWs)
{
if (nVal != 0)
{
ILgWritingSystem lgws = LgWritingSystem.CreateFromDBObject(m_cache, nVal);
m_writer.Write(" {0}=\"{1}\"",
tpt == (int)FwTextPropType.ktptWs ? "ws" : "wsBase", lgws.RFC4646bis);
}
}
else if (tpt != (int)FwTextPropType.ktptMarkItem)
{
WriteIntTextProp(m_writer, m_cache.LanguageWritingSystemFactoryAccessor, tpt, nVar, nVal);
}
}
string sRun = tssPara.get_RunText(irun);
Guid guidFootnote = Guid.Empty;
for (int itsp = 0; itsp < ctsp; ++itsp)
{
sVal = ttpRun.GetStrProp(itsp, out tpt);
Debug.Assert(tpt != (int)FwTextPropType.ktptBulNumFontInfo);
Debug.Assert(tpt != (int)FwTextPropType.ktptWsStyle);
WriteStrTextProp(m_writer, tpt, sVal);
if (sRun != null && sRun.Length == 1 && sRun[0] == StringUtils.kchObject)
{
Debug.Assert(tpt == (int)FwTextPropType.ktptObjData);
fSkipText = true;
if ((int)sVal[0] == (int)FwObjDataTypes.kodtOwnNameGuidHot)
guidFootnote = MiscUtils.GetGuidFromObjData(sVal.Substring(1));
}
}
m_writer.Write(">");
if (!fSkipText)
{
int cch = tri.ichLim - tri.ichMin;
if (cch > 0)
{
sRun = sRun.Normalize();
m_writer.Write(XmlUtils.MakeSafeXml(sRun));
}
}
if (fMarkItem)
m_writer.WriteLine("</Run></Item>");
//.........这里部分代码省略.........
示例15: WriteLiftTsStringContent
/// <summary>
/// For LIFT, span is the name of the run element, and it's output only with "interesting"
/// values, that is, attributes that aren't the writing system of the overall string.
/// </summary>
/// <param name="tssVal"></param>
/// <param name="writer"></param>
/// <param name="wsString"></param>
private void WriteLiftTsStringContent(ITsString tssVal, XmlWriter writer, int wsString)
{
int crun = tssVal.RunCount;
int nVar;
int tpt;
int nProp;
string sProp;
bool fSpan;
for (int irun = 0; irun < crun; ++irun)
{
ITsTextProps ttp = tssVal.get_Properties(irun);
fSpan = true;
if (ttp.IntPropCount == 1 && ttp.StrPropCount == 0)
{
nProp = ttp.GetIntProp(0, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs && nProp == wsString)
fSpan = false;
}
if (fSpan)
{
writer.WriteStartElement("span");
int cprop = ttp.IntPropCount;
for (int iprop = 0; iprop < cprop; ++iprop)
{
nProp = ttp.GetIntProp(iprop, out tpt, out nVar);
if (tpt == (int)FwTextPropType.ktptWs && nProp != wsString)
{
IWritingSystem ws = m_wsManager.Get(nProp);
writer.WriteAttributeString("lang", ws.Id);
}
}
cprop = ttp.StrPropCount;
for (int iprop = 0; iprop < cprop; ++iprop)
{
sProp = ttp.GetStrProp(iprop, out tpt);
if (tpt == (int)FwTextPropType.ktptNamedStyle)
writer.WriteAttributeString("class", sProp);
else
TsStringUtils.WriteHref(tpt, sProp, writer);
}
}
string sRun = tssVal.get_RunText(irun);
writer.WriteString(Icu.Normalize(sRun, m_eIcuNormalizationMode));
if (fSpan)
writer.WriteEndElement();
}
}