Renpy uses a lot of python and custom made code, in order to show text that is displayed on screen using the say statement
.
After running into some troubles with the nvl mode
within renpy, I found it necessary to know how many lines are going to be displayed on screen (taking into account the font size, naturally and the size of the text window).
So my question:
As I didn't find anything in the documentation in regards to that, I'm wondering if there is any command or other possibility to precalculate the height of a text that is to be displayed?
get_virtual_layout()
is part ofclass Text
intext.py
.I copied this from
text.py
:This looks promising, I think.
With the virtual text size (width, height) you could possibly calculate the lines of text by using the text window size (width, height).
Also, it is worth to take a deeper look at
text.py
(e.g.def render(self, width, height, st, at)
), in order to get to know the use ofvirtual_layout
.I hope it helps somehow.
Update:
def render(...)
initializes the virtual layouts, soget_virtual_layout()
is not None anymore, but represents an instance ofLayout()
with scaled width and height.