public virtual void Formatted(Format.Field attr, Object value, int start, int end, StringBuffer buffer) { if (start != end) { if (start < Size) { // Adjust attributes of existing runs int index = Size; int asIndex = AttributedStrings.Count - 1; while (start < index) { AttributedString @as = AttributedStrings[asIndex--]; int newIndex = index - @as.Length(); int aStart = System.Math.Max(0, start - newIndex); @as.AddAttribute(attr, value, aStart, System.Math.Min(end - start, @as.Length() - aStart) + aStart); index = newIndex; } } if (Size < start) { // Pad attributes AttributedStrings.Add(new AttributedString(buffer.Substring(Size, start - Size))); Size = start; } if (Size < end) { // Add new string int aStart = System.Math.Max(start, Size); AttributedString @string = new AttributedString(buffer.Substring(aStart, end - aStart)); @string.AddAttribute(attr, value); AttributedStrings.Add(@string); Size = end; } } }
public virtual void Formatted(int fieldID, Format.Field attr, Object value, int start, int end, StringBuffer buffer) { Formatted(attr, value, start, end, buffer); }