Hey kigyo! Fantastic plug-in. I'm running into an issue getting text to properly scale in the mock-up textbox. It only updates after leaving the options screen and coming back. Any clue where I might be going wrong here? This is the code for my testbox. Thank you so much in advance! :) I placed the block of code from 3A for the mockup in my preferences!
screen testbox():
if _preferences.text_cps != 0:
$ textcps = _preferences.text_cps
if _preferences.text_cps == 0:
$ textcps = 500
$ show_sample = len("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam condimentum sagittis mauris, eget vestibulum ex.")/(textcps+1.5)
$ hide_sample = show_sample + 1.0 # formula for hide text delay
frame:
background Transform(Frame("gui/textbox.png",xalign=0.5, yalign=1.0), alpha=persistent.dialogueBoxOpacity)
xysize(760,280)
xalign 0.84 yalign 0.82
timer show_sample repeat True action Show("mock_text", hide_after=hide_sample)
screen mock_text(hide_after=False):
frame:
background None
xysize(760,280)
xalign 0.84 yalign 0.72
style_prefix "texttest"
text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam condimentum sagittis mauris, eget vestibulum ex." slow_cps True xalign 0.5 timer 5.0 action Hide("text_preview") repeat True
if hide_after:
timer hide_after action Hide("mock_text")
I’m leaving this here just in case someone needs it.
If you have not updated Ren’py, the FieldValue might not take min and max argument, so you can rearrange it this way to get it to work.
bar value FieldValue(persistent, "text_size", offset=text_size_minimum, range=text_size_maximum-text_size_minimum, step=1.0, style=u'slider')
This comes just right in time!
I have just added a couple of accessibility options and the scaling bugs me so much.
How would this work with Line Spacing Scaling in Shift+A (assuming that Font Size Scaling is unchanged but the Spacing is changed? Or what would happen if I replace the OG Font Size Scaling slider with this one, then use the Line Spacing slider? Would I have to disable that and let this plugin handle it instead?
I would have to test this out myself, but this plugin only messes with the horizontal width of the textbox and therefore should not interfere with vertical spacing. So I’ll go ahead and assume it’s compatible with the Line Spacing slider.
One more thing along this question, since it’s been crossing my mind as well. Do you think it’s possible to add automatic textbox height scaling as well, so when the font size gets bigger, the textbox itself expands vertically to accommodate it? I believe it may cause your textbox background to be stretched depending on how your frame is constructed, but I feel like that’s a good enough tradeoff.
← Return to Plugin
Comments
Log in with itch.io to leave a comment.
Hey kigyo! Fantastic plug-in. I'm running into an issue getting text to properly scale in the mock-up textbox. It only updates after leaving the options screen and coming back. Any clue where I might be going wrong here? This is the code for my testbox. Thank you so much in advance! :) I placed the block of code from 3A for the mockup in my preferences!
Hi Kristi, that's a great point, I completely forgot to mention that in the tutorial :O
I'll update it when I get the chance, but for now, add...
...to the "Lorem ipsum" text element in your mock_text screen (for example directly after xalign 0.5).
Let me know if that works!
i could kiss you. (platonically, of course)
This worked! Thank you so much! :)
I'm glad, you're so welcome!
I’m leaving this here just in case someone needs it. If you have not updated Ren’py, the FieldValue might not take min and max argument, so you can rearrange it this way to get it to work.
bar value FieldValue(persistent, "text_size", offset=text_size_minimum, range=text_size_maximum-text_size_minimum, step=1.0, style=u'slider')
This comes just right in time! I have just added a couple of accessibility options and the scaling bugs me so much.
How would this work with Line Spacing Scaling in Shift+A (assuming that Font Size Scaling is unchanged but the Spacing is changed? Or what would happen if I replace the OG Font Size Scaling slider with this one, then use the Line Spacing slider? Would I have to disable that and let this plugin handle it instead?
I would have to test this out myself, but this plugin only messes with the horizontal width of the textbox and therefore should not interfere with vertical spacing. So I’ll go ahead and assume it’s compatible with the Line Spacing slider.
Please do report back if that’s wrong, though!
One more thing along this question, since it’s been crossing my mind as well. Do you think it’s possible to add automatic textbox height scaling as well, so when the font size gets bigger, the textbox itself expands vertically to accommodate it? I believe it may cause your textbox background to be stretched depending on how your frame is constructed, but I feel like that’s a good enough tradeoff.
The current code only accounts for the text itself, not the window around it, but I can definitely see the value in that use case!
I just added this functionality as a donation goal. If there’s enough support, I’ll make this happen!
Thank you very much, I think that is fair!