Making different fonts have different font sizes

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
User avatar
Laniessa
Veteran
Posts: 251
Joined: Wed Feb 09, 2011 11:10 am
Completed: CDC, Cerulean, WBW, Helena's Flowers
Projects: Chomp Chomp, WaV
Tumblr: adirosa
Deviantart: adirosa
Contact:

Making different fonts have different font sizes

#1 Post by Laniessa »

Hello! I'm trying to make it so the player can choose between two fonts and font sizes for the default text. However, when I use style preferences, I can only make the settings let the player set the font size as a number. I want to manually set what the 'regular' font size and 'larger' font sizes are for the two fonts individually, as one font is significantly larger than the other at the size number size. How would I go about accomplishing this?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making different fonts have different font sizes

#2 Post by PyTom »

Can you post the code you're using. I think it will be easier if I adapted it.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Laniessa
Veteran
Posts: 251
Joined: Wed Feb 09, 2011 11:10 am
Completed: CDC, Cerulean, WBW, Helena's Flowers
Projects: Chomp Chomp, WaV
Tumblr: adirosa
Deviantart: adirosa
Contact:

Re: Making different fonts have different font sizes

#3 Post by Laniessa »

From the options.rpy:

Code: Select all

    renpy.register_style_preference("font", "alegreya", style.default, "font", "fonts/AlegreyaSans-Regular.otf")
    renpy.register_style_preference("font", "opendyslexic", style.default, "font", "fonts/Opendyslexic-Regular.otf")
    renpy.register_style_preference("size", "regularalegreya", style.default, "size", 28)  # This is the regular size I want for Alegreya Sans
    renpy.register_style_preference("size", "largealegreya", style.default, "size", 34)    # This is the larger size I want for Alegreya Sans
    renpy.register_style_preference("size", "regularopendyslexic", style.default, "size", 20)  # This is the regular size I want for Opendyslexic
    renpy.register_style_preference("size", "largealegreya", style.default, "size", 23)    # This is the larger size I want for Opendyslexic
From the screens.rpy, I'm using an imagemap.

Code: Select all

        hotspot (409,552,136,28) action [StylePreference("font","alegreya")]
        hotspot (648,552,215,28) action [StylePreference("font","opendyslexic")]
        hotspot (648,434,194,30) action [StylePreference("size","regularalegreya")]
        hotspot (409,434,197,30) action [StylePreference("size","largealegreya")]

Post Reply

Who is online

Users browsing this forum: bilmem, Google [Bot]