static int GetProperSplitBoundIndex(List <LayoutFarm.Composers.TextSplitBound> _textSplitBoundsList, int charIndex) { int j = _textSplitBoundsList.Count; int accumChar = 0; for (int i = 0; i < j; ++i) { LayoutFarm.Composers.TextSplitBound splittedBound = _textSplitBoundsList[i]; if (accumChar + splittedBound.length >= charIndex) { return(i); } accumChar += splittedBound.length; } return(-1);//not found? }
static string GetString(char[] buffer, LayoutFarm.Composers.TextSplitBound bound) { return(new string(buffer, bound.startIndex, bound.length)); }
string GetString(char[] buffer, LayoutFarm.Composers.TextSplitBound bound) { char[] substr = new char[bound.length]; Array.Copy(buffer, bound.startIndex, substr, 0, bound.length); return(new string(substr)); }