ADDITIONAL SYSTEM INFORMATION :
macOS Big Sur on Mac mini (late 2014). OpenJDK and OpenJFX 17
A DESCRIPTION OF THE PROBLEM :
The individual glyphs of the default font are rendered too close to each other, with the result that aesthetically a JavaFX application's menu looks terrible when compared to native applications.
I thought I could work around the problem by using css styling, but setting style class on Menu instances have no effect. The styleClass property of a MenuItem (which Menu extends) doesn't appear to be used. I can make menu items look better with CustomMenuItem, but I cannot do anything about Menu instances.
So I guess this has something to do with JavaFX menus not appearing in the top menu bar on a Mac. If JetBrains can make it work with their Swing-based IntelliJ, why cannot JavaFX applications do the same?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a simple hello world-type application with a menu and observe the individual glyphs of the font which a rendered partially overlapping each other.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Either render the menu the way native macOS application menus are rendered, i.e. in the system menubar or fix the default rendering of text in all JavaFX controls when running on macOS, since this ugliness can be observed everywhere! It should not require additional effort by a developer to achieve an aesthetically pleasing result by default.
ACTUAL -
All default text rendering on a Mac look terrible, but especially in Menus. It is possible to make text rendering look better through css styling - but not for menus.
---------- BEGIN SOURCE ----------
package com.example.menubug;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.io.IOException;
public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
MenuBar menuBar = new MenuBar();
VBox vBox = new VBox(menuBar);
Menu menu1 = new Menu("LookAtTheOoooooosInThisMenu");
menuBar.getMenus().add(menu1);
Scene scene = new Scene(vBox, 960, 600);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround for Menu instances
FREQUENCY : always