[RESOLVED] Centered text in screen

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
Camille
Eileen-Class Veteran
Posts: 1227
Joined: Sat Apr 23, 2011 2:43 pm
Completed: Please see http://trash.moe
Projects: the head well lost
Organization: L3
Tumblr: narihira
Deviantart: crownwaltz
itch: lore
Contact:

[RESOLVED] Centered text in screen

#1 Post by Camille »

I'm trying to make a calendar screen and I want all the text to be centered like so:

Image

But when I try turning that mock-up into screen language, I end up with this:

Image

As you can see, the text doesn't center properly for each month/day/day of the week block. It's particularly noticeable on the first and last days. My code currently looks like this:

Code: Select all

    text "25" font "type/JuraDemiBold.ttf" size 100 color "#48ddb4" xalign 0.18 yalign 0.4 text_align 0.5 min_width 137 justify True
    text "MAY" font "type/Jura-Medium.otf" size 58 color "#48ddb4" xalign 0.18 yalign 0.5 text_align 0.5 min_width 137 justify True
    text "TUESDAY" font "type/JuraBook.ttf" size 25 color "#48ddb4" xalign 0.18 yalign 0.6 text_align 0.5 min_width 137 justify True

    text "26" font "type/JuraDemiBold.ttf" size 100 color "#48ddb4" xalign 0.35 yalign 0.4 text_align 0.5 min_width 137 justify True
    text "MAY" font "type/Jura-Medium.otf" size 58 color "#48ddb4" xalign 0.35 yalign 0.5 text_align 0.5 min_width 137 justify True
    text "WEDNESDAY" font "type/JuraBook.ttf" size 25 color "#48ddb4" xalign 0.35 yalign 0.6 text_align 0.5 min_width 137 justify True

    text "27" font "type/JuraDemiBold.ttf" size 100 color "#48ddb4" xalign 0.51 yalign 0.4 text_align 0.5 min_width 137 justify True
    text "MAY" font "type/Jura-Medium.otf" size 58 color "#48ddb4" xalign 0.51 yalign 0.5 text_align 0.5 min_width 137 justify True
    text "THURSDAY" font "type/JuraBook.ttf" size 25 color "#48ddb4" xalign 0.51 yalign 0.6 text_align 0.5 min_width 137 justify True

    text "28" font "type/JuraDemiBold.ttf" size 100 color "#48ddb4" xalign 0.68 yalign 0.4 text_align 0.5 min_width 137 justify True
    text "MAY" font "type/Jura-Medium.otf" size 58 color "#48ddb4" xalign 0.68 yalign 0.5 text_align 0.5 min_width 137 justify True
    text "FRIDAY" font "type/JuraBook.ttf" size 25 color "#48ddb4" xalign 0.68 yalign 0.6 text_align 0.5 min_width 137 justify True

    text "29" font "type/JuraDemiBold.ttf" size 100 color "#48ddb4" xalign 0.85 yalign 0.4 text_align 0.5 min_width 137 justify True
    text "MAY" font "type/Jura-Medium.otf" size 58 color "#48ddb4" xalign 0.85 yalign 0.5 text_align 0.5 min_width 137 justify True
    text "SATURDAY" font "type/JuraBook.ttf" size 25 color "#48ddb4" xalign 0.85 yalign 0.6 text_align 0.5 min_width 137 justify True
I set the min_width to 137 because that's the width of the word WEDNESDAY which, as far as I can tell, is the widest that these blocks are ever going to be. (the months are abbreviated) Any help would be greatly appreciated.
Last edited by Camille on Sun Nov 22, 2015 3:04 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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: Centered text in screen

#2 Post by PyTom »

Can you grab a nightly? There's a bug fixed there that might have been causing this problem.
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
Camille
Eileen-Class Veteran
Posts: 1227
Joined: Sat Apr 23, 2011 2:43 pm
Completed: Please see http://trash.moe
Projects: the head well lost
Organization: L3
Tumblr: narihira
Deviantart: crownwaltz
itch: lore
Contact:

Re: Centered text in screen

#3 Post by Camille »

Oh yay, it works properly after updating! That's a huge relief, thanks.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Majestic-12 [Bot]