Skip to content

Commit

Permalink
Bug fix: line style changes didn't invalidate text style.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmester committed Jul 8, 2021
1 parent 5f8f782 commit 53bfba8
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions src/PdfToSvg/Drawing/SvgRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,35 +343,52 @@ private void cm_SetMatrix(double a, double b, double c, double d, double e, doub
[Operation("gs/LW")]
private void w_LineWidth(double lineWidth)
{
graphicsState.StrokeWidth = lineWidth;
if (graphicsState.StrokeWidth != lineWidth)
{
graphicsState.StrokeWidth = lineWidth;
textBuilder.InvalidateStyle();
}
}

[Operation("J")]
[Operation("gs/LC")]
private void J_LineCap(int lineCap)
{
graphicsState.StrokeLineCap = lineCap;
if (graphicsState.StrokeLineCap != lineCap)
{
graphicsState.StrokeLineCap = lineCap;
textBuilder.InvalidateStyle();
}
}

[Operation("j")]
[Operation("gs/LJ")]
private void j_LineJoin(int lineJoin)
{
graphicsState.StrokeLineJoin = lineJoin;
if (graphicsState.StrokeLineJoin != lineJoin)
{
graphicsState.StrokeLineJoin = lineJoin;
textBuilder.InvalidateStyle();
}
}

[Operation("M")]
[Operation("gs/ML")]
private void M_MiterLimit(double miterLimit)
{
graphicsState.StrokeMiterLimit = miterLimit;
if (graphicsState.StrokeMiterLimit != miterLimit)
{
graphicsState.StrokeMiterLimit = miterLimit;
textBuilder.InvalidateStyle();
}
}

[Operation("d")]
private void d_DashArray(int[] dashArray, int dashPhase)
{
graphicsState.StrokeDashArray = dashArray;
graphicsState.StrokeDashPhase = dashPhase;
textBuilder.InvalidateStyle();
}

[Operation("gs/D")]
Expand All @@ -383,13 +400,21 @@ private void gs_D_DashArray(object[] args)
[Operation("gs/CA")]
private void gs_CA_StrokeAlpha(double alpha)
{
graphicsState.StrokeAlpha = alpha;
if (graphicsState.StrokeAlpha != alpha)
{
graphicsState.StrokeAlpha = alpha;
textBuilder.InvalidateStyle();
}
}

[Operation("gs/ca")]
private void gs_ca_FillAlpha(double alpha)
{
graphicsState.FillAlpha = alpha;
if (graphicsState.FillAlpha != alpha)
{
graphicsState.FillAlpha = alpha;
textBuilder.InvalidateStyle();
}
}

[Operation("gs")]
Expand Down

0 comments on commit 53bfba8

Please sign in to comment.