Hi All,
What options can be used to crop text to fit the size of the textbutton (or label)?
Crop text to fit size of button
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.
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.
- 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: Crop text to fit size of button
The idea that jumps to my mind is to make the text into an image and crop that, and use the cropped image in the screen.
Technically you would not have a label or a textbutton, but you would have the visual effect.
Code: Select all
image croptext = Text("{color=#f00}TEXT TO CROP{/color}", size=35)
image croppedtext = Crop((0, 15, 220, 15), "croptext")
screen croptextshower():
add "croppedtext"
Re: Crop text to fit size of button
The core for textbutton is just a default button, then a text child on top of it. The text layer don't have any binded parameter on size.
All style parameters are in fact sent to the button-father, and you have to specifically use a text_ parameter to intervene to the child. And such damned child don't have text_cropping = 0.5, for example.
So, in a word, not only there's not an option, but there can't be ever one.
As a fun fact, the button does instead take the text one as default size, if no style intervene.
What a strange world.
All style parameters are in fact sent to the button-father, and you have to specifically use a text_ parameter to intervene to the child. And such damned child don't have text_cropping = 0.5, for example.
So, in a word, not only there's not an option, but there can't be ever one.
As a fun fact, the button does instead take the text one as default size, if no style intervene.
What a strange world.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
Re: Crop text to fit size of button
Thank you. I thought I missed something obvious. I used something similar to what Per K Grok suggested but using add Text(..) inside a button with ATL. Everything looks neat, however, I don't like that it is a bit "bulky" for a single button, when you add styles, change font color on hover, etc. There are a couple of things I want to try and I will post the code later.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Zapor