#5 assert against pdfbox positions and fix by implementing subroutines

This commit is contained in:
Eliot Jones
2018-11-23 18:00:53 +00:00
parent 0e701754e0
commit 03938d8352
4 changed files with 1794 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,14 @@
public static void Run(Type1BuildCharContext context)
{
var index = (int)context.Stack.PopTop();
var subroutine = context.Subroutines[index];
foreach (var command in subroutine.Commands)
{
command.Match(x => context.Stack.Push(x),
x => x.Run(context));
}
}
}
}

View File

@@ -5,6 +5,8 @@
internal class Type1BuildCharContext
{
public IReadOnlyDictionary<int, Type1CharStrings.CommandSequence> Subroutines { get; }
public decimal WidthX { get; set; }
public decimal WidthY { get; set; }
@@ -25,6 +27,11 @@
public IReadOnlyList<PdfPoint> FlexPoints { get; }
public Type1BuildCharContext(IReadOnlyDictionary<int, Type1CharStrings.CommandSequence> subroutines)
{
Subroutines = subroutines;
}
public void AddFlexPoint(PdfPoint point)
{

View File

@@ -44,9 +44,9 @@
return glyph;
}
private static CharacterPath Run(CommandSequence sequence)
private CharacterPath Run(CommandSequence sequence)
{
var context = new Type1BuildCharContext();
var context = new Type1BuildCharContext(Subroutines);
foreach (var command in sequence.Commands)
{
command.Match(x => context.Stack.Push(x),