[Solved] Can't Change Font

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Theoria
Newbie
Posts: 3
Joined: Tue Aug 08, 2017 11:35 pm
Contact:

[Solved] Can't Change Font

#1 Post by Theoria »

I know I must be missing something very elementary, but this is very disheartening, this being the very first thing I tried doing on the engine. I've been thinking about it for many hours now, but, I really have no idea how to interpret this error...


It works fine in its default state, when the fonts are specified as 'DejaVuSans.ttf'. I tried Times New Roman and Calibri, as simple Windows fonts, but as you can see, both produced the same error message -- "An exception has occured".

Image


Thank you beforehand, to anyone kind enough to respond...
Last edited by Theoria on Wed Aug 09, 2017 6:28 am, edited 2 times in total.

User avatar
PMscenarios
Regular
Posts: 93
Joined: Sat Jul 01, 2017 11:22 pm
Completed: Whale's Waldo
Projects: In Blood, Xenopathy
Tumblr: pmscenarios
itch: pmscenarios
Contact:

Re: Can't Change Font

#2 Post by PMscenarios »

You need to supply the font. You can download free fonts from google.
If you put it somewhere other than the main "game" folder you also need to tell it where to look: define.gui.text_font = "font/roboto.ttf"
(this example means I've put the downloaded font into a folder called "font" in the game folder)
ImageImageImage

Theoria
Newbie
Posts: 3
Joined: Tue Aug 08, 2017 11:35 pm
Contact:

Re: Can't Change Font

#3 Post by Theoria »

Ah. But, why does it work fine in its default form, when there is no "DejaVuSans.ttf" font in the game folder? Because of that, I just assumed that the script can detect the fonts that are installed on the computer.

Either way, thank you... Hope this prevents further possible confusions from me, in the future, and I don't need to consult here so often.

User avatar
PMscenarios
Regular
Posts: 93
Joined: Sat Jul 01, 2017 11:22 pm
Completed: Whale's Waldo
Projects: In Blood, Xenopathy
Tumblr: pmscenarios
itch: pmscenarios
Contact:

Re: [Mostly Solved] Can't Change Font

#4 Post by PMscenarios »

It's said several times in the documentation that "DejaVuSans" is the default font supplied with the engine - for example here:
Changing Fonts
Ren'Py ships with a default font (DejaVuSans) that covers most western languages, but other fonts are often needed.
It's also mentioned under gui customization and text - font.

The engine has several defaults like that - try for example writing a sample game without supplying a background or sprite image.

In this case not supplying the font file would mean the game (well, the text) wouldn't work on computers that don't have the custom font spesified installed. The engine is designed to be able to seemlessly compile for several different OSs, and offers translations to different type sets/languages, so requiring the file is the only choice.

...

Overall, having learned from scratch this last month I've found the documentation has a tendency to assume you know basic programming/game design. While it tells you functions and commands, it usually doesn't tell you where to place them and how to use them.
ImageImageImage

Theoria
Newbie
Posts: 3
Joined: Tue Aug 08, 2017 11:35 pm
Contact:

Re: [Mostly Solved] Can't Change Font

#5 Post by Theoria »

Thank you again... Now I understand. If it wasn't for the weird error message -- "Could not find font u'times.ttf'." (why "u"?) -- I think I would've searched the document more thoroughly.

"While it tells you functions and commands, it usually doesn't tell you where to place them and how to use them."

I see. Indeed, I virtually have no programming background. I can only hope that I'll be able to pull through, and be able to make a decent game eventually.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]