namespace UglyToad.PdfPig.Graphics.Operations.TextState
{
using System.IO;
///
/// Sets the word spacing.
///
public class SetWordSpacing : IGraphicsStateOperation
{
///
/// The symbol for this operation in a stream.
///
public const string Symbol = "Tw";
///
public string Operator => Symbol;
///
/// Sets the width of the space ' ' character. For horizontal
/// writing positive values increase the gap between words separated by space, for vertical writing
/// positive values decrease the gap.
///
public decimal Spacing { get; }
///
/// Create a new .
///
/// The word spacing.
public SetWordSpacing(decimal spacing)
{
Spacing = spacing;
}
///
public void Run(IOperationContext operationContext)
{
var currentState = operationContext.GetCurrentState();
currentState.FontState.WordSpacing = Spacing;
}
///
public void Write(Stream stream)
{
stream.WriteNumberText(Spacing, Symbol);
}
///
public override string ToString()
{
return $"{Spacing} {Symbol}";
}
}
}