mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
#21 add a test for accented characters and fill in more writing methods for content stream operators
the output is currently incorrect for accented characters
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
using Content;
|
||||
using PdfPig.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Modify the current transformation matrix by concatenating the specified matrix.
|
||||
/// </summary>
|
||||
internal class ModifyCurrentTransformationMatrix : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "cm";
|
||||
|
@@ -4,9 +4,13 @@
|
||||
using System.IO;
|
||||
using Content;
|
||||
|
||||
/// <summary>
|
||||
/// Restore the graphics state by removing the most recently saved state from the stack and making it the current state.
|
||||
/// </summary>
|
||||
internal class Pop : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "Q";
|
||||
|
||||
public static readonly Pop Value = new Pop();
|
||||
|
||||
public string Operator => Symbol;
|
||||
@@ -30,7 +34,8 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -3,6 +3,9 @@
|
||||
using System.IO;
|
||||
using Content;
|
||||
|
||||
/// <summary>
|
||||
/// Save the current graphics state on the graphics state stack.
|
||||
/// </summary>
|
||||
internal class Push : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "q";
|
||||
@@ -14,11 +17,6 @@
|
||||
{
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Symbol;
|
||||
}
|
||||
|
||||
public void Run(IOperationContext context, IResourceStore resourceStore)
|
||||
{
|
||||
context.PushState();
|
||||
@@ -26,7 +24,13 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,9 @@
|
||||
using Content;
|
||||
using PdfPig.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Begin a text object, initializing the text matrix and the text line matrix to the identity matrix. Text objects cannot be nested.
|
||||
/// </summary>
|
||||
internal class BeginText : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "BT";
|
||||
|
@@ -4,6 +4,9 @@
|
||||
using Content;
|
||||
using PdfPig.Core;
|
||||
|
||||
/// <summary>
|
||||
/// End a text object, discarding the text matrix.
|
||||
/// </summary>
|
||||
internal class EndText : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "ET";
|
||||
|
@@ -30,7 +30,8 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -4,6 +4,10 @@
|
||||
using Content;
|
||||
using TextState;
|
||||
|
||||
/// <summary>
|
||||
/// Move to the start of the next line, offset from the start of the current line by (tx, ty).
|
||||
/// This operator also sets the leading parameter in the text state.
|
||||
/// </summary>
|
||||
internal class MoveToNextLineWithOffsetSetLeading : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "TD";
|
||||
@@ -33,7 +37,12 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
stream.WriteDecimal(Tx);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Ty);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -5,6 +5,9 @@
|
||||
using Content;
|
||||
using PdfPig.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Set the text matrix and the text line matrix.
|
||||
/// </summary>
|
||||
internal class SetTextMatrix : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "Tm";
|
||||
@@ -33,7 +36,20 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
stream.WriteDecimal(Value[0]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Value[1]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Value[2]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Value[3]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Value[4]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteDecimal(Value[5]);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -3,6 +3,10 @@
|
||||
using System.IO;
|
||||
using Content;
|
||||
|
||||
/// <summary>
|
||||
/// Set the character spacing to a number expressed in unscaled text space units.
|
||||
/// Initial value: 0.
|
||||
/// </summary>
|
||||
internal class SetCharacterSpacing : IGraphicsStateOperation
|
||||
{
|
||||
public const string Symbol = "Tc";
|
||||
@@ -25,7 +29,10 @@
|
||||
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
stream.WriteDecimal(Spacing);
|
||||
stream.WriteWhiteSpace();
|
||||
stream.WriteText(Symbol);
|
||||
stream.WriteNewLine();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
Reference in New Issue
Block a user