- 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();
}
}
====================
========= 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();
}
}
====================
- duplicates
-
JDK-8114634 Crash with accessing OpenType/CFF fonts
- Closed