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

Java Crash : Loading font file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • Mac OSX 10.6.7 , JDK6u26 , FX 2.0 b38

      - Please see the attached test case , the otf font file, screenshot of crash.

      ========= case code =========
      import com.sun.javafx.scene.text.FontManager;
      import java.net.URL;
      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.text.Font;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      /**
       *
       * @author Peter Song
       * @date Aug 30, 2011 4:10:59 PM
       */
      public class OTFFontTest extends Application{

          public static void main(String[] args) {
              Application.launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              Scene scn = new Scene(new Group(), 700 , 700);
              Text txt = new Text("something");
              txt.setX(30);
              txt.setY(130);
              String path = ClassLoader.getSystemClassLoader().getResource("fx/bugs/verification/data/fonts/MyriadPro-Bold.otf").toExternalForm();
              System.out.println(path);
              Font font = Font.loadFont(path.substring(6), 12);
              txt.setFont(font);
              ((Group)scn.getRoot()).getChildren().add(txt);
              stage.setScene(scn);
              stage.show();
          }
      }
      ====================

            thor Thor Johannesson (Inactive)
            srikchan Srikalyan Chandrashekar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: