Problem:
When TextFlow has non-zero lineSpacing property set, preferred height calculation does not include the line spacing amount for the last line (see the screenshot and notice zero space between "line four" and "Next Component...").
While this looks like a bug in the context of rich text area where multiple TextFlows are stacked vertically, the workaround is to simply add the lineSpacing amount to the height of each paragraph which is fairly trivial. Another argument might be to treat the lineSpacing similarly to how whitespace is treated when wrapping text (we don't want to have leading or trailing whitespace there, see JDK-8314215 for example).
The main reason for this ticket is to initiate a discussion.
SCCE:
```
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Path;
import javafx.scene.shape.PathElement;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlow_RangeShape extends Application {
@Override
public void start(Stage stage) throws Exception {
String text = "TextFlow{lineSpacing=20}\nline two\nline three\nline four";
TextFlow t = new TextFlow(new Text(text));
t.setLineSpacing(20);
Path path = new Path();
path.setManaged(false);
path.setFill(Color.rgb(255, 255, 128, 0.5));
path.setStroke(Color.rgb(128, 128, 0));
Label label = new Label("Next Component Starts Here");
label.setOpacity(1.0);
label.setBackground(Background.fill(Color.DARKGRAY));
VBox vb = new VBox();
vb.getChildren().addAll(path, t, label);
VBox.setVgrow(label, Priority.ALWAYS);
Scene scene = new Scene(vb);
stage.setScene(scene);
stage.setWidth(400);
stage.setHeight(200);
stage.setTitle("TextFlow.rangeShape() ignores lineSpacing");
stage.show();
Platform.runLater(() -> {
PathElement[] pe = t.rangeShape(0, text.length());
path.getElements().setAll(pe);
});
}
}
```