Hello everyone,
I was wondering if there is a function in JS that allows for the size of the font to change dynamically depending of how long the string is inside a textbox is.
To be more specific, I am talking about skill descriptions. You know, when you hover over a skill in battle or in the game menu, you have a little box at the top that tells you what the skill does.
Now, I am working on a rogue-lite game in MV (think something along the lines of slay the spire, hades, Dead Cells etc.)
and so my skill descriptions have to be highly detailed and accurate.
The contents of skill descriptions change depending on the circumstances.
We are talking damage numbers, healing values, resource generation, conditions, skill classifications, keywords etc.
And depending on your choices, these things can change drastically for any given skill.
And in some circumstances, the amount of additional words, letters and numbers make the whole thing go beyond the textbox.
So to finally come to the main point, I'd like some kind of system where the size of the font shrinks if the textbox is exhausted of space.
Note: It would be optimal if the text would only ever shrink to accomodate the textbox and not increase in size ever.
Important: I currently have the ability to execute functions and script commands inside of the description box, which could help with the solution.
Think something like the wordwrap function, but instead of going to the next line, you make the font smaller to fit in everything.
Any suggestions are welcome.
I was wondering if there is a function in JS that allows for the size of the font to change dynamically depending of how long the string is inside a textbox is.
To be more specific, I am talking about skill descriptions. You know, when you hover over a skill in battle or in the game menu, you have a little box at the top that tells you what the skill does.
Now, I am working on a rogue-lite game in MV (think something along the lines of slay the spire, hades, Dead Cells etc.)
and so my skill descriptions have to be highly detailed and accurate.
The contents of skill descriptions change depending on the circumstances.
We are talking damage numbers, healing values, resource generation, conditions, skill classifications, keywords etc.
And depending on your choices, these things can change drastically for any given skill.
And in some circumstances, the amount of additional words, letters and numbers make the whole thing go beyond the textbox.
So to finally come to the main point, I'd like some kind of system where the size of the font shrinks if the textbox is exhausted of space.
Note: It would be optimal if the text would only ever shrink to accomodate the textbox and not increase in size ever.
Important: I currently have the ability to execute functions and script commands inside of the description box, which could help with the solution.
Think something like the wordwrap function, but instead of going to the next line, you make the font smaller to fit in everything.
Any suggestions are welcome.
