text: public void ApplyFont(int startIndex, int endIndex, short fontIndex){if (startIndex > endIndex)throw new ArgumentException("Start index must be less than end index.");if (startIndex < 0 || endIndex > Length)throw new ArgumentException("Start and end index not in range.");if (startIndex == endIndex)return;short currentFont = NO_FONT;if (endIndex != Length){currentFont = this.GetFontAtIndex(endIndex);}_string = CloneStringIfRequired();System.Collections.Generic.List<UnicodeString.FormatRun> formatting = _string.FormatIterator();ArrayList deletedFR = new ArrayList();if (formatting != null){IEnumerator<UnicodeString.FormatRun> formats = formatting.GetEnumerator();while (formats.MoveNext()){UnicodeString.FormatRun r = formats.Current;if ((r.CharacterPos >= startIndex) && (r.CharacterPos < endIndex)){deletedFR.Add(r);}}}foreach (UnicodeString.FormatRun fr in deletedFR){_string.RemoveFormatRun(fr);}_string.AddFormatRun(new UnicodeString.FormatRun((short)startIndex, fontIndex));if (endIndex != Length)_string.AddFormatRun(new UnicodeString.FormatRun((short)endIndex, currentFont));AddToSSTIfRequired();}