Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Van Dusen
12,136 PointsWhy am I not getting the Papyrus Font?
Here is my code..
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
// Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
Group root = new Group();
Text txt = new Text("Sup?");
txt.setFont(new Font("Papyrus", 80));
Label label = new Label("Name:");
TextField nameField = new TextField();
GridPane grid = new GridPane();
grid.add(label, 0, 0);
grid.add(nameField, 1, 0);
grid.setHgap(20);
Button btn = new Button();
grid.add(btn, 1, 1);
// grid.setGridLinesVisible(true);
btn.setText("Say Sup!");
btn.setOnAction(evt -> System.out.printf("Sup %s!%n", nameField.getText()));
txt.setY(50);
VBox box = new VBox();
box.getChildren().addAll(txt, grid);
root.getChildren().add(box);
primaryStage.setTitle("Sup");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
4 Answers
Seth Kroger
56,414 PointsYou won't get it if the Papyrus font isn't already installed on your computer. There is a way to load a custom font in the next program of the course, but the way it's done here can only access fonts that are available on your system.
Michael Van Dusen
12,136 PointsThanks.
Test Test
21,581 PointsOn Windows you don't have this Font pre-installed. You can pick another one like "Algerian" font looks pretty cool.
nihouse
7,160 PointsI have a pretty fresh Windows 10 installtion, and I have that font.
I haven't installed a lot, but ok... I have a full version of MSOffice installed...
Craig Dennis
Treehouse TeacherHi Michael!
Are you on Windows? Trying to track down the root problem so I can update the notes.
Thanks, Craig
Fernando Hernandez
11,013 PointsHi Craig,
I'm on a fairly new and bare Windows 10 installation, and the Papyrus font does not appear either. The font does correctly scale up to size 80 though.
Nino Ross
8,264 PointsI am on windows and I still can't change the font. Papyrus, Algerian, Ariel, comicsans nothing works :(
Anuraag Mishra
Courses Plus Student 4,286 PointsFaced Same Problem, This course was going Flawlessly till now, BrainStormed, then remembered i faced the similar problem while doing some CSS work while back.
SOLUTION: just put Family name in single inverted comma like 'Arial' or 'Papyrus' or 'Comin Sans MS'. style="-fx-font-family: 'Comic Sans MS'"
Papyrus may not work in windows as it does not come pre-installed on windows. Posting Solution on other Discussions with same problem too.
Menno Gouw
2,375 PointsI skimmed over the comments to find a link to the font, since I am a perfectionist and want to follow the video as closely as possible, but unfortunately could not find it. A quick google search led me to this page and you can download the font for free here. What bothers me is the lack of license or creator info. Someone made this and thus it has copyright protection but this site just puts it up for download. I am sure you will be alright using it just for the tutorial but I would not recommend to use it for any other projects until you know what license it has. This includes open source projects and all other types of projects.
Anyway, the font is not exactly the same but it is pretty close. Just open the archive and install the .ttf file, it is named "Papyrus" and your program should immediately pick it up once you installed it.
Anuraag Mishra
Courses Plus Student 4,286 PointsAnuraag Mishra
Courses Plus Student 4,286 PointsFaced Same Problem, This course was going Flawlessly till now, BrainStormed, then remembered i faced the similar problem while doing some CSS work while back.
SOLUTION: just put Family name in single inverted comma like 'Arial' or 'Papyrus' or 'Comin Sans MS'. style="-fx-font-family: 'Comic Sans MS'"
Papyrus may not work in windows as it does not come pre-installed on windows.