mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
add a run method to all graphics state operations
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
namespace UglyToad.Pdf.Graphics.Operations.TextShowing
|
||||
{
|
||||
using Content;
|
||||
using TextPositioning;
|
||||
using TextState;
|
||||
using Util.JetBrains.Annotations;
|
||||
|
||||
internal class MoveToNextLineShowTextWithSpacing : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "\"";
|
||||
@@ -10,6 +15,10 @@
|
||||
|
||||
public decimal CharacterSpacing { get; }
|
||||
|
||||
[CanBeNull]
|
||||
public byte[] Bytes { get; }
|
||||
|
||||
[CanBeNull]
|
||||
public string Text { get; }
|
||||
|
||||
public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, string text)
|
||||
@@ -19,6 +28,26 @@
|
||||
Text = text;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{WordSpacing} {CharacterSpacing} {Text} {Symbol}";
|
||||
|
||||
Reference in New Issue
Block a user