Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public void generateNormalAppearance()
cs.moveTo(lineLength, llo);
cs.lineTo(lineLength, llo + ll + lle);

String startPointEndingStyle = annotation.getStartPointEndingStyle();
String endPointEndingStyle = annotation.getEndPointEndingStyle();
if (annotation.hasCaption() && !contents.isEmpty())
{
// Note that Adobe places the text as a caption even if /CP is not set
Expand Down Expand Up @@ -187,7 +189,7 @@ public void generateNormalAppearance()

// draw the line horizontally, using the rotation CTM to get to correct final position
// that's the easiest way to calculate the positions for the line before and after inline caption
if (SHORT_STYLES.contains(annotation.getStartPointEndingStyle()))
if (SHORT_STYLES.contains(startPointEndingStyle))
{
cs.moveTo(lineEndingSize, y);
}
Expand All @@ -209,7 +211,7 @@ public void generateNormalAppearance()
cs.lineTo(xOffset - lineEndingSize, y);
cs.moveTo(lineLength - xOffset + lineEndingSize, y);
}
if (SHORT_STYLES.contains(annotation.getEndPointEndingStyle()))
if (SHORT_STYLES.contains(endPointEndingStyle))
{
cs.lineTo(lineLength - lineEndingSize, y);
}
Expand All @@ -228,8 +230,8 @@ public void generateNormalAppearance()
{
cs.beginText();
cs.setFont(font, FONT_SIZE);
cs.newLineAtOffset(xOffset + captionHorizontalOffset,
y + yOffset + captionVerticalOffset);
cs.newLineAtOffset(xOffset + captionHorizontalOffset,
y + yOffset + captionVerticalOffset);
cs.showText(contents);
cs.endText();
}
Expand All @@ -244,15 +246,15 @@ public void generateNormalAppearance()
}
else
{
if (SHORT_STYLES.contains(annotation.getStartPointEndingStyle()))
if (SHORT_STYLES.contains(startPointEndingStyle))
{
cs.moveTo(lineEndingSize, y);
}
else
{
cs.moveTo(0, y);
}
if (SHORT_STYLES.contains(annotation.getEndPointEndingStyle()))
if (SHORT_STYLES.contains(endPointEndingStyle))
{
cs.lineTo(lineLength - lineEndingSize, y);
}
Expand All @@ -277,13 +279,13 @@ public void generateNormalAppearance()
}

// check for LE_NONE only needed to avoid q cm Q for that case
if (!LE_NONE.equals(annotation.getStartPointEndingStyle()))
if (!LE_NONE.equals(startPointEndingStyle))
{
cs.saveGraphicsState();
if (ANGLED_STYLES.contains(annotation.getStartPointEndingStyle()))
if (ANGLED_STYLES.contains(startPointEndingStyle))
{
cs.transform(Matrix.getRotateInstance(angle, x1, y1));
drawStyle(annotation.getStartPointEndingStyle(), cs, 0, y, lineEndingSize, hasStroke, hasBackground, false);
drawStyle(startPointEndingStyle, cs, 0, y, lineEndingSize, hasStroke, hasBackground, false);
}
else
{
Expand All @@ -293,19 +295,19 @@ public void generateNormalAppearance()
// We use the angle we already know and the distance y to translate to the new coordinate.
float xx1 = x1 - (float) (y * Math.sin(angle));
float yy1 = y1 + (float) (y * Math.cos(angle));
drawStyle(annotation.getStartPointEndingStyle(), cs, xx1, yy1, lineEndingSize, hasStroke, hasBackground, false);
drawStyle(startPointEndingStyle, cs, xx1, yy1, lineEndingSize, hasStroke, hasBackground, false);
}
cs.restoreGraphicsState();
}

// check for LE_NONE only needed to avoid q cm Q for that case
if (!LE_NONE.equals(annotation.getEndPointEndingStyle()))
if (!LE_NONE.equals(endPointEndingStyle))
{
// save / restore not needed because it's the last one
if (ANGLED_STYLES.contains(annotation.getEndPointEndingStyle()))
if (ANGLED_STYLES.contains(endPointEndingStyle))
{
cs.transform(Matrix.getRotateInstance(angle, x2, y2));
drawStyle(annotation.getEndPointEndingStyle(), cs, 0, y, lineEndingSize, hasStroke, hasBackground, true);
drawStyle(endPointEndingStyle, cs, 0, y, lineEndingSize, hasStroke, hasBackground, true);
}
else
{
Expand All @@ -315,7 +317,7 @@ public void generateNormalAppearance()
// We use the angle we already know and the distance y to translate to the new coordinate.
float xx2 = x2 - (float) (y * Math.sin(angle));
float yy2 = y2 + (float) (y * Math.cos(angle));
drawStyle(annotation.getEndPointEndingStyle(), cs, xx2, yy2, lineEndingSize, hasStroke, hasBackground, true);
drawStyle(endPointEndingStyle, cs, xx2, yy2, lineEndingSize, hasStroke, hasBackground, true);
}
}
}
Expand Down