Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8126697

J2D pipeline "leaks" jfx embedded fonts to AWT/Swing

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u6
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:

      Description

      Run the following snippet on J2D and some other (ES2, D3D) pipeline
      public class FXSwing {
          private static void initAndShowGUI() {
              String url = "file:///Users/felipe/Documents/fonts/CrashLandingBB.ttf";
              final Font jxFont = Font.loadFont(url, 36);
              java.awt.Font awtFont = new java.awt.Font(jxFont.getName(), java.awt.Font.PLAIN, 36);
              JFrame frame = new JFrame("FX");
              final JFXPanel fxPanel = new JFXPanel();
              JLabel jlabel = new JLabel("my swing label");
              jlabel.setFont(awtFont);
              JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, fxPanel, jlabel);
              splitter.setBackground(java.awt.Color.WHITE);
              splitter.setDividerLocation(300);
              frame.add(splitter);
              Platform.runLater(new Runnable() {
                  public void run() {
                      VBox box = new VBox();
                      box.setAlignment(Pos.CENTER_LEFT);
                      Text text = new Text("my jfx text");
                      text.setFont(jxFont);
                      box.getChildren().add(text);
                      Scene scene = new Scene(box, 200, 200, Color.WHITE);
                      fxPanel.setScene(scene);
                  }
              });
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(600, 200);
              frame.setVisible(true);
          }
          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      initAndShowGUI();
                  }
              });
          }
      }

      The call to java.awt.Font awtFont = new java.awt.Font(jxFont.getName(), java.awt.Font.PLAIN, 36); only creates the "CrashLanding" font on the J2D pipeline.
       

        Attachments

        1. es2.png
          es2.png
          15 kB
        2. es2.tiff
          21 kB
        3. j2d.png
          j2d.png
          13 kB

          Activity

            People

            • Assignee:
              fheidric Felipe Heidrich (Inactive)
              Reporter:
              fheidric Felipe Heidrich (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: