A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!
This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
-
BáiYù
- Regular
- Posts: 126
- Joined: Fri Apr 01, 2016 10:02 am
- Completed: 8=D~<3, Talk To Me, This Life Escapes Me
- Projects: Lust Bounty
- Organization: tofurocks, Dream Team, Boop Studios
- Github: baiyu-dev
- itch: tofurocks
-
Contact:
#1
Post
by BáiYù » Wed Apr 20, 2016 3:38 pm
This function allows players to choose which font they would like to use while playing the game. This does not affect the font used for the GUI.
Code is from the
All of Cute Demon Crashers! custom code thread, I simply dug it out from all the script files.
Code: Select all
# Insert into the options.rpy
init -1 python hide:
# Fonts that may be chosen by the user
renpy.register_style_preference(
"text", "Default", style.say_dialogue, "font", "gui/default.ttf")
renpy.register_style_preference(
"text", "Open Dyslexic", style.say_dialogue, "font", "gui/OpenDyslexic-Regular.otf")
Code: Select all
#insert into screens.rpy in the Preference screen section
frame:
style_group "pref"
has vbox
label _("Font Selection")
textbutton "Default" action StylePreference("text", "Default")
textbutton "Open Dyslexic" action StylePreference("text", "Open Dyslexic")
Download the OpenDyslexic font from their official website.
-
NeuroDolphin
- Newbie
- Posts: 3
- Joined: Wed Aug 22, 2018 6:36 pm
- Projects: A Cry in the Dark
-
Contact:
#2
Post
by NeuroDolphin » Tue Aug 28, 2018 12:47 pm
Thanks a lot for posting this here, it's really nice to try and make games that much more accessible for people.
Thanks to you, my game now supports Open Dyslexia!
-
Andredron
- Veteran
- Posts: 435
- Joined: Thu Dec 28, 2017 2:37 pm
- Location: Russia
-
Contact:
#3
Post
by Andredron » Thu Aug 30, 2018 6:22 am
Size font in option Renpy
Code: Select all
# screens.rpy
#. ,,
Screen preferences:
tag menu
# etc. flat screen
#. ,,
# at the very end, add this code:
frame:
style_group "pref"
has a vbox
label _ ("Text Size% s"% (ts_min + persistent.ts))
bar value FieldValue (constant, "ts", ts_max - ts_min)
on 'hide' action SetTS ()
on 'replace' action SetTS ()
init python:
# font sizes
ts_min = 16 # from these
ts_max = 48 # still
if they are persistent.ts is not None:
persistent.ts = 0
def setts ():
style. default.size = ts_min + persistent.ts
style. rebuild ()
SetTS = renpy. curry
setts ()
#
https://pastebin.com/PD4XLBAk
https://yadi.sk/d/pnm13XXL35aSWN working example
-
Ayael
- Regular
- Posts: 73
- Joined: Fri Apr 07, 2017 2:17 pm
- Projects: Anoldor, medieval fantasy otome game.
-
Contact:
#4
Post
by Ayael » Fri Jan 24, 2020 3:34 pm
I did a complementary tutorial to change all font for OpenDyslexic (including menu, label and so on).
(You can find it here :
viewtopic.php?f=51&t=57895)
Users browsing this forum: Google [Bot]