Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
6 changes: 6 additions & 0 deletions UglyToad.PdfPig.Rendering.Skia.Tests/PageSizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ namespace UglyToad.PdfPig.Rendering.Skia.Tests;

public class PageSizeTests
{
private static readonly HashSet<string> _documentsToIgnore =
[
"Type3Test.pdf" // fails in 0.1.15
];

public static IEnumerable<object[]> GetAllDocuments => Directory.EnumerateFiles(Helper.DocumentsFolder, "*.pdf")
.Select(Path.GetFileName)
.Where(p => !_documentsToIgnore.Contains(p))
.Select(p => new object[] { p });

[Theory]
Expand Down
2 changes: 2 additions & 0 deletions UglyToad.PdfPig.Rendering.Skia.Tests/TestRendering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ public class TestRendering
"0011979_2.png",
"0011979.pdf", 2, 2
},

// TODO - Add Type3Test.pdf test
};

[Theory]
Expand Down
3 changes: 2 additions & 1 deletion UglyToad.PdfPig.Rendering.Skia.Tests/VisualTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class VisualTests
private static readonly HashSet<string> _documentsToIgnore =
[
"SPARC - v9 Architecture Manual.pdf",
"TIKA-1552-0.pdf"
"TIKA-1552-0.pdf",
"Type3Test.pdf" // fails in 0.1.15
];

public static IEnumerable<object[]> GetAllDocuments => Directory.EnumerateFiles(Helper.DocumentsFolder, "*.pdf")
Expand Down
16 changes: 15 additions & 1 deletion UglyToad.PdfPig.Rendering.Skia/Helpers/SkiaFontCache.Type3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using UglyToad.PdfPig.Graphics.Operations;
using UglyToad.PdfPig.Graphics.Operations.InlineImages;
using UglyToad.PdfPig.Graphics.Operations.PathConstruction;
using UglyToad.PdfPig.Graphics.Operations.PathPainting;
using UglyToad.PdfPig.Graphics.Operations.SpecialGraphicsState;
using UglyToad.PdfPig.Graphics.Operations.TextState;
using UglyToad.PdfPig.PdfFonts;
Expand Down Expand Up @@ -82,8 +83,14 @@ private static Type3CachedGlyph BuildType3Glyph(IType3Font font, int code, Type3
/// spec-ignored, so the current text colour drives painting at draw time).</item>
/// <item>No <c>InvokeNamedXObject</c> (Do) or <c>BeginInlineImage</c> (BI/ID/EI) appears
/// — those produce raster output that can't be replayed as a path.</item>
/// <item>No stroking paint operator (<c>S s B B* b b*</c>) appears. The vector path is
/// replayed as a single fill governed by the text rendering mode, so it cannot reproduce
/// a stroke's line width, dash pattern, cap/join or stroking colour. A d1 stencil is
/// allowed to stroke (only colour is inherited, not the other stroke parameters), so such
/// glyphs must run their real operators via the picture path to look correct.</item>
/// </list>
/// Anything else (d0 coloured glyphs, bitmaps, missing marker) falls into the picture path.
/// Anything else (d0 coloured glyphs, bitmaps, stroked stencils, missing marker) falls into
/// the picture path.
/// </summary>
private static bool CanCacheAsVector(IReadOnlyList<IGraphicsStateOperation> operations)
{
Expand All @@ -100,6 +107,13 @@ private static bool CanCacheAsVector(IReadOnlyList<IGraphicsStateOperation> oper
case InvokeNamedXObject:
case BeginInlineImage:
return false; // raster content
case StrokePath: // S
case CloseAndStrokePath: // s
case FillPathNonZeroWindingAndStroke: // B
case FillPathEvenOddRuleAndStroke: // B*
case CloseFillPathNonZeroWindingAndStroke: // b
case CloseFillPathEvenOddRuleAndStroke: // b*
return false; // stroke appearance can't be replayed by a fill-only path
}
}
return sawD1;
Expand Down
Loading