mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
#5 assert against pdfbox positions and fix by implementing subroutines
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,14 @@
|
|||||||
public static void Run(Type1BuildCharContext context)
|
public static void Run(Type1BuildCharContext context)
|
||||||
{
|
{
|
||||||
var index = (int)context.Stack.PopTop();
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
internal class Type1BuildCharContext
|
internal class Type1BuildCharContext
|
||||||
{
|
{
|
||||||
|
public IReadOnlyDictionary<int, Type1CharStrings.CommandSequence> Subroutines { get; }
|
||||||
|
|
||||||
public decimal WidthX { get; set; }
|
public decimal WidthX { get; set; }
|
||||||
|
|
||||||
public decimal WidthY { get; set; }
|
public decimal WidthY { get; set; }
|
||||||
@@ -25,6 +27,11 @@
|
|||||||
|
|
||||||
public IReadOnlyList<PdfPoint> FlexPoints { get; }
|
public IReadOnlyList<PdfPoint> FlexPoints { get; }
|
||||||
|
|
||||||
|
public Type1BuildCharContext(IReadOnlyDictionary<int, Type1CharStrings.CommandSequence> subroutines)
|
||||||
|
{
|
||||||
|
Subroutines = subroutines;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddFlexPoint(PdfPoint point)
|
public void AddFlexPoint(PdfPoint point)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -44,9 +44,9 @@
|
|||||||
return glyph;
|
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)
|
foreach (var command in sequence.Commands)
|
||||||
{
|
{
|
||||||
command.Match(x => context.Stack.Push(x),
|
command.Match(x => context.Stack.Push(x),
|
||||||
|
Reference in New Issue
Block a user