Center words in a Text displayable?

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
newbiemate
Regular
Posts: 85
Joined: Tue Dec 19, 2017 1:36 pm
Contact:

Center words in a Text displayable?

#1 Post by newbiemate »

I have a text title and an image:

Code: Select all

fixed:
    xpos 100
    ypos 200
    vbox:
        text "The Book of all the Things!" xanchor 0.5 anchor 0.5 xmaximum 80
        add "images/book.png" xanchor 0.5 yanchor 0.5

This would display the words like this:

Code: Select all

The Book of
all the 
Things!
But I would like all the words, especially the words wrapped, to be centered. Something like this:

Code: Select all

The Book of 
  all the
  Things!

Is there a way to do that?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Center words in a Text displayable?

#2 Post by Per K Grok »

newbiemate wrote: Sat Apr 27, 2019 10:48 pm I have a text title and an image:

Code: Select all

fixed:
    xpos 100
    ypos 200
    vbox:
        text "The Book of all the Things!" xanchor 0.5 anchor 0.5 xmaximum 80
        add "images/book.png" xanchor 0.5 yanchor 0.5

This would display the words like this:

Code: Select all

The Book of
all the 
Things!
But I would like all the words, especially the words wrapped, to be centered. Something like this:

Code: Select all

The Book of 
  all the
  Things!

Is there a way to do that?
text_align 0.5

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Center words in a Text displayable?

#3 Post by Alex »

newbiemate wrote: Sat Apr 27, 2019 10:48 pm

Code: Select all

fixed:
    xpos 100
    ypos 200
    vbox:
        text "The Book of all the Things!" xanchor 0.5 anchor 0.5 xmaximum 80
        add "images/book.png" xanchor 0.5 yanchor 0.5
Try to get rid of xmaximum...

newbiemate
Regular
Posts: 85
Joined: Tue Dec 19, 2017 1:36 pm
Contact:

Re: Center words in a Text displayable?

#4 Post by newbiemate »

Thanks!! text_align 0.5 works!

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Center words in a Text displayable?

#5 Post by xavimat »

You can use a little know text style property: layout "subtitle" https://www.renpy.org/doc/html/style_pr ... rty-layout
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], dragondatingsim, DragoonHP, Google [Bot]