mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
#26 make almost all operators public
This commit is contained in:
@@ -1,27 +1,52 @@
|
||||
namespace UglyToad.PdfPig.Graphics.Operations.TextShowing
|
||||
{
|
||||
using System.IO;
|
||||
using Content;
|
||||
using TextPositioning;
|
||||
using TextState;
|
||||
using Util.JetBrains.Annotations;
|
||||
|
||||
internal class MoveToNextLineShowTextWithSpacing : IGraphicsStateOperation
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Move to the next line and show a text string, using the first number as the word spacing and the second as the character spacing
|
||||
/// </summary>
|
||||
public class MoveToNextLineShowTextWithSpacing : IGraphicsStateOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// The symbol for this operation in a stream.
|
||||
/// </summary>
|
||||
public const string Symbol = "\"";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Operator => Symbol;
|
||||
|
||||
/// <summary>
|
||||
/// The word spacing.
|
||||
/// </summary>
|
||||
public decimal WordSpacing { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The character spacing.
|
||||
/// </summary>
|
||||
public decimal CharacterSpacing { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The bytes of the text.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public byte[] Bytes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The text to show.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="MoveToNextLineShowTextWithSpacing"/>.
|
||||
/// </summary>
|
||||
/// <param name="wordSpacing">The word spacing.</param>
|
||||
/// <param name="characterSpacing">The character spacing.</param>
|
||||
/// <param name="text">The text to show.</param>
|
||||
public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, string text)
|
||||
{
|
||||
WordSpacing = wordSpacing;
|
||||
@@ -29,6 +54,12 @@
|
||||
Text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="MoveToNextLineShowTextWithSpacing"/>.
|
||||
/// </summary>
|
||||
/// <param name="wordSpacing">The word spacing.</param>
|
||||
/// <param name="characterSpacing">The character spacing.</param>
|
||||
/// <param name="hexBytes">The bytes of the text to show.</param>
|
||||
public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, byte[] hexBytes)
|
||||
{
|
||||
WordSpacing = wordSpacing;
|
||||
@@ -36,24 +67,27 @@
|
||||
Bytes = hexBytes;
|
||||
}
|
||||
|
||||
public void Run(IOperationContext operationContext, IResourceStore resourceStore)
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
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);
|
||||
setWordSpacing.Run(operationContext);
|
||||
setCharacterSpacing.Run(operationContext);
|
||||
moveToNextLine.Run(operationContext);
|
||||
showText.Run(operationContext);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{WordSpacing} {CharacterSpacing} {Text} {Symbol}";
|
||||
|
||||
Reference in New Issue
Block a user