Skip to content

Commit

Permalink
PDFBOX-5946: replace drawCross with drawZapf call
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923624 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Feb 6, 2025
1 parent 7878f0a commit bdb799c
Showing 1 changed file with 1 addition and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void generateNormalAppearance()
drawNote(annotation, contentStream);
break;
case PDAnnotationText.NAME_CROSS:
drawCross(annotation, contentStream);
drawZapf(annotation, contentStream, 19, 0, "a22"); // 0x2716
break;
case PDAnnotationText.NAME_CIRCLE:
drawCircles(annotation, contentStream);
Expand Down Expand Up @@ -271,41 +271,6 @@ private void drawInsert(PDAnnotationText annotation, final PDAppearanceContentSt
contentStream.closeAndFillAndStroke();
}

private void drawCross(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
PDRectangle bbox = adjustRectAndBBox(annotation, 19, 19);

// should be a square, but who knows...
float min = Math.min(bbox.getWidth(), bbox.getHeight());

// small = offset nearest bbox edge
// large = offset second nearest bbox edge
float small = min / 10;
float large = min / 5;

contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(1);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.59f); // value from Adobe

contentStream.moveTo(small, large);
contentStream.lineTo(large, small);
contentStream.lineTo(min / 2, min / 2 - small);
contentStream.lineTo(min - large, small);
contentStream.lineTo(min - small, large);
contentStream.lineTo(min / 2 + small, min / 2);
contentStream.lineTo(min - small, min - large);
contentStream.lineTo(min - large, min - small);
contentStream.lineTo(min / 2, min / 2 + small);
contentStream.lineTo(large, min - small);
contentStream.lineTo(small, min - large);
contentStream.lineTo(min / 2 - small, min / 2);
contentStream.closeAndFillAndStroke();

// alternatively, this could also be drawn with Zapf Dingbats "a21"
}

private void drawHelp(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
Expand Down

0 comments on commit bdb799c

Please sign in to comment.