]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/FlagNode.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / nodes / FlagNode.java
index 598e130091391303febf5b14cbe039e4bda3ef2e..b2e973949517d7e66ff06391c7e1b20e27bd90fc 100644 (file)
@@ -28,6 +28,8 @@ import java.util.Arrays;
 
 import org.simantics.scenegraph.g2d.G2DNode;
 import org.simantics.scenegraph.g2d.G2DPDFRenderingHints;
+import org.simantics.scenegraph.g2d.G2DRenderingHints;
+import org.simantics.scenegraph.g2d.G2DRenderingHints.TextRenderingMode;
 import org.simantics.scenegraph.utils.GeometryUtils;
 
 public class FlagNode extends G2DNode {
@@ -310,7 +312,8 @@ public class FlagNode extends G2DNode {
             lineDist *= gScaleRecip;
             double y = startY;
             double textAreaWidth = textArea.getWidth() * gScaleRecip;
-            boolean isRenderingPdf = g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_WRITER) != null;
+            boolean renderAsText = g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_WRITER) != null
+                    || g.getRenderingHint(G2DRenderingHints.KEY_TEXT_RENDERING_MODE) == TextRenderingMode.AS_TEXT;
 
             for (int i = 0; i < flagText.length; ++i) {
                 //String line = flagText[i];
@@ -343,7 +346,7 @@ public class FlagNode extends G2DNode {
                     System.out.println(" DRAW: '" + flagText[i] + "' with " + g.getTransform());
 
                 // #6459: render as text in PDF and paths on screen
-                if (isRenderingPdf)
+                if (renderAsText)
                     g.drawString(flagText[i], (float) x, (float) y);
                 else
                     textLayout[i].draw(g, (float) x, (float) y);