2018-01-10 19:49:32 +00:00
|
|
|
|
namespace UglyToad.PdfPig.Graphics.Operations.TextShowing
|
2017-11-22 18:41:34 +00:00
|
|
|
|
{
|
2017-12-02 14:11:20 +00:00
|
|
|
|
using Content;
|
|
|
|
|
|
using TextPositioning;
|
|
|
|
|
|
using TextState;
|
|
|
|
|
|
using Util.JetBrains.Annotations;
|
|
|
|
|
|
|
2017-11-26 22:19:42 +00:00
|
|
|
|
internal class MoveToNextLineShowTextWithSpacing : IGraphicsStateOperation
|
2017-11-22 18:41:34 +00:00
|
|
|
|
{
|
|
|
|
|
|
public const string Symbol = "\"";
|
|
|
|
|
|
|
|
|
|
|
|
public string Operator => Symbol;
|
|
|
|
|
|
|
|
|
|
|
|
public decimal WordSpacing { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public decimal CharacterSpacing { get; }
|
|
|
|
|
|
|
2017-12-02 14:11:20 +00:00
|
|
|
|
[CanBeNull]
|
|
|
|
|
|
public byte[] Bytes { get; }
|
|
|
|
|
|
|
|
|
|
|
|
[CanBeNull]
|
2017-11-22 18:41:34 +00:00
|
|
|
|
public string Text { get; }
|
|
|
|
|
|
|
2017-11-26 22:19:42 +00:00
|
|
|
|
public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, string text)
|
2017-11-22 18:41:34 +00:00
|
|
|
|
{
|
|
|
|
|
|
WordSpacing = wordSpacing;
|
|
|
|
|
|
CharacterSpacing = characterSpacing;
|
|
|
|
|
|
Text = text;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-02 14:11:20 +00:00
|
|
|
|
public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, byte[] hexBytes)
|
|
|
|
|
|
{
|
|
|
|
|
|
WordSpacing = wordSpacing;
|
|
|
|
|
|
CharacterSpacing = characterSpacing;
|
|
|
|
|
|
Bytes = hexBytes;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Run(IOperationContext operationContext, IResourceStore resourceStore)
|
|
|
|
|
|
{
|
|
|
|
|
|
var setWordSpacing = new SetWordSpacing(WordSpacing);
|
|
|
|
|
|
var setCharacterSpacing = new SetCharacterSpacing(CharacterSpacing);
|
|
|
|
|
|
var moveToNextLine = MoveToNextLine.Value;
|
|
|
|
|
|
var showText = Text != null ? new ShowText(Text) : new ShowText(Bytes);
|
|
|
|
|
|
|
|
|
|
|
|
setWordSpacing.Run(operationContext, resourceStore);
|
|
|
|
|
|
setCharacterSpacing.Run(operationContext, resourceStore);
|
|
|
|
|
|
moveToNextLine.Run(operationContext, resourceStore);
|
|
|
|
|
|
showText.Run(operationContext, resourceStore);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-11-22 18:41:34 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return $"{WordSpacing} {CharacterSpacing} {Text} {Symbol}";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|