import javafx.application.Application;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextBoundsType;
import javafx.stage.Stage;

public class Why extends Application
{
    @Override
    public void start(Stage arg0) throws Exception
    {
         System.out.println("A::" + textHeight( "X", 5, TextBoundsType.LOGICAL)); // A
         System.out.println("B::" + textHeight("X", 5, TextBoundsType.LOGICAL_VERTICAL_CENTER)); // B
         System.out.println("C::" + textHeight("X", 5, TextBoundsType.LOGICAL)); // C
         System.exit(0);
    }

    public double textHeight(String text, double size, TextBoundsType tbt)
    {
        Text t = new Text(text);
        t.setBoundsType(tbt);
        t.setFont(Font.font("arial", size));
        return t.getLayoutBounds().getHeight();
    }

    public static void main(String[] args)
    {
        launch(args);
    }
}
