The Row Height Conondrum #458
Replies: 3 comments
-
May be of help: Go MeasureString provides But at this moment the documentation here does not clarify the font size unit__, is it points, millimeters, pixels? |
Beta Was this translation helpful? Give feedback.
-
Additionally, I noticed that |
Beta Was this translation helpful? Give feedback.
-
I don't know if this is the right topic to discuss this issue, but... I am implementing this feature to automatically calculate the line size, but I realized that the matrixcode component has its size calculated based on the available space (height and width). In this case I see two options:
I'm really unsure of the best way |
Beta Was this translation helpful? Give feedback.
-
I think that burdening the end-user (users of the library) with having to specify a row height should actually be addressed in version 2 (latest release is 2.0.7) rather than 3. Currently the library works well for form-making rather than document-making.
I believe
Maroto/V2
should address these 3 low-level) issues and not burden the end-developer with having to deal with these as it is currently (v2.0.7
).1st Problem: Row Height
There is a certain relation between font height and row height which is applicable in single line per row use cases.
In this case, in a first attempt, with curve fitting (regression), a simple cubic (3rd order polynomial) provides a good prediction of the single-line row height necessary for a given font height.
2nd Problem: How many rows in a page
My experiments revealed that for a Letter-sized page without header and a single-line footer (page nr.), a single page fits 240 rows, for example 60 rows of a row height of 4.
Obviously, that amount is slightly different for an A4 page.
3rd Problem: Multi-line rows
This issue is of extreme importance for using Maroto in regular document generation where text is composed of paragraphs (multiple lines).
In this situation we have several variables to predict the necessary row height for a given text of 1..n paragraphs:
With that in mind there are methods to compute font metrics, knowing how a paragraph of a given font size, family & style would be split into several lines. Given those parameters and a mapping function, we could know how many row height units are needed to properly output a (series of) paragraphs.
Y: number of lines
X: Font metrics (family, size, style)
Z: Column Span (horizontal space)
y = f(x, z)
Beta Was this translation helpful? Give feedback.
All reactions