Skip to content
Snippets Groups Projects
Commit 941c78d4 authored by Ulrich Schöpp's avatar Ulrich Schöpp
Browse files

Fix text position in SVG exporter; add more font attributes

SVG coordinates refer to the text baseline rather than the upper left
corner as in JavaFX.

Issue-Ref: 3924
Issue-Url: https://af3-developer.fortiss.org/issues/3924


Signed-off-by: default avatarUlrich Schöpp <schoepp@fortiss.org>
parent b9da95a2
No related branches found
No related tags found
1 merge request!89[3924] Fix small bugs in fx diagram editor
......@@ -9,4 +9,4 @@ FeedbackChange.java b088fa89af648f1674f2f9c1f7f99d585ce801ca YELLOW
GridCanvasVisual.java 734027d56af342cd01ff445ba9347b8dbb6c83c2 YELLOW
MVCBundleManager.java 2b4ab114c55b30a3d98d7135458f8f3ddd244d58 YELLOW
MouseState.java ff90af6d1cca427ef6f3fded76367b535120a5df YELLOW
SVGExporter.java 2211f06d81c7b0523ae52dc832410a76875a9e07 YELLOW
SVGExporter.java cbbd1eceb2910fd5c1693e05c5303a193127b9db YELLOW
......@@ -197,9 +197,13 @@ final class SVGExporter {
return;
}
sb.append("<text ");
double yBaselineOffsetFromTop =
text.getBoundsInParent().getHeight() - text.getBaselineOffset();
setProp("x", text.getX(), sb);
setProp("y", text.getY(), sb);
setProp("font-family", "Arial, Helvetica, sans-serif", sb);
// SVG uses the y-coordinate of the baseline
setProp("y", text.getY() + yBaselineOffsetFromTop, sb);
setProp("font-size", text.getFont().getSize(), sb);
setProp("font-family", text.getFont().getName() + ", Arial, Helvetica, sans-serif", sb);
st.applySVGStyle(sb);
sb.append(">\n");
sb.append(text.getText());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment