Answer the question
In order to leave comments, you need to log in
How to calculate the height of the occupied text without rendering?
There is a block of a certain width. It is necessary to change its height depending on the occupied text. Everything is generated in a file. We know the font size and indents.
What am I doing:
var set_width = 20;
var font_size = 11;
var count_symbol = text.length;
var count_line = Math.round((count_symbol)/set_width )+1;
var set_height = (font_size *count_line)+((font_size /2)*count_line);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question