\r
// PDF \r
PdfWriter writer = (PdfWriter) g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_WRITER);\r
+ boolean isRenderingPdf = writer != null;\r
boolean isPdfField = false;\r
String fieldName = null;\r
if (writer != null) {\r
\r
// Base text\r
g.setColor(color);\r
- renderText(g, xOffset);\r
+ renderText(g, xOffset, isRenderingPdf);\r
\r
Shape clip = g.getClip();\r
\r
g.setColor(SELECTION_BACKGROUND_COLOR);\r
g.fill(selShape);\r
g.setColor(Color.WHITE);\r
- //line.layout.draw(g, 0, 0);\r
- g.drawString(line.getText(), 0, 0);\r
+ // #6459: render as text in PDF and paths on screen\r
+ if (isRenderingPdf)\r
+ g.drawString(line.getText(), 0, 0);\r
+ else\r
+ line.layout.draw(g, 0, 0);\r
line.translateInv(g, xOffset, 0);\r
}\r
}\r
\r
if (renderText) {\r
g.setColor(color);\r
- renderText(g, 0);\r
+ renderText(g, 0, isRenderingPdf);\r
}\r
\r
}\r
}\r
}\r
}\r
- private void renderText(Graphics2D g, float xOffset) {\r
+ private void renderText(Graphics2D g, float xOffset, boolean isRenderingPdf) {\r
//g.draw(tightBoundsCache); // DEBUG\r
for (Line line : lines) {\r
- //line.layout.draw(g, line.alignedPosX + xOffset, line.alignedPosY);\r
- g.drawString(line.getText(), line.alignedPosX + xOffset, line.alignedPosY);\r
+ // #6459: render as text in PDF and paths on screen\r
+ if (isRenderingPdf)\r
+ g.drawString(line.getText(), line.alignedPosX + xOffset, line.alignedPosY);\r
+ else\r
+ line.layout.draw(g, line.alignedPosX + xOffset, line.alignedPosY);\r
//g.draw(line.abbox); // DEBUG\r
}\r
}\r
import java.util.Arrays;\r
\r
import org.simantics.scenegraph.g2d.G2DNode;\r
+import org.simantics.scenegraph.g2d.G2DPDFRenderingHints;\r
import org.simantics.scenegraph.utils.GeometryUtils;\r
\r
public class FlagNode extends G2DNode {\r
lineDist *= gScaleRecip;\r
double y = startY;\r
double textAreaWidth = textArea.getWidth() * gScaleRecip;\r
+ boolean isRenderingPdf = g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_WRITER) != null;\r
\r
for (int i = 0; i < flagText.length; ++i) {\r
//String line = flagText[i];\r
if (DEBUG)\r
System.out.println(" DRAW: '" + flagText[i] + "' with " + g.getTransform());\r
\r
- //textLayout[i].draw(g, (float) x, (float) y);\r
- g.drawString(flagText[i], (float) x, (float) y);\r
+ // #6459: render as text in PDF and paths on screen\r
+ if (isRenderingPdf)\r
+ g.drawString(flagText[i], (float) x, (float) y);\r
+ else\r
+ textLayout[i].draw(g, (float) x, (float) y);\r
\r
y += lineDist;\r
y += rect.getHeight();\r