Font Selection Option (For use with OpenDyslexic Font)

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.
Post Reply
User avatar
Posts: 129
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

Font Selection Option (For use with OpenDyslexic Font)

#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
        "text", "Default", style.say_dialogue, "font", "gui/default.ttf")
        "text", "Open Dyslexic", style.say_dialogue, "font", "gui/OpenDyslexic-Regular.otf")

Code: Select all

#insert into screens.rpy in the Preference screen section
                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.
Commissions Closed

User avatar
Posts: 3
Joined: Wed Aug 22, 2018 6:36 pm
Projects: A Cry in the Dark

Re: Font Selection Option (For use with OpenDyslexic Font)

#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!

User avatar
Posts: 440
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia

Re: Font Selection Option (For use with OpenDyslexic Font)

#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:
                 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 ()
# working example
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). Update 22.06.18

Honest Critique

User avatar
Posts: 75
Joined: Fri Apr 07, 2017 2:17 pm
Projects: Anoldor, medieval fantasy otome game.

Re: Font Selection Option (For use with OpenDyslexic Font)

#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)

Post Reply

Who is online

Users browsing this forum: No registered users