Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question / Feature Request: Is it possible to layout text into a fixed number of rows? #1351

Open
ndbroadbent opened this issue Jun 7, 2024 · 0 comments

Comments

@ndbroadbent
Copy link

ndbroadbent commented Jun 7, 2024

Hello, I have an area on my page that I want to divide into a fixed number of rows (e.g. a table with a single column.) I want to be able to render text into the first row, overflow into the next row, and then shrink to fit all of the text if it overflows the last row.

We have been using #formatted_text_box with a fixed array of strings, which works great for overflow: :truncate, but doesn't have the desired result for overflow: :shrink_to_fit.

Here are some test cases where :truncate is working, but the highlighted :shrink_to_fit is causing problems (not fitting the text into 4 evenly spaced lines.) I'm attempting to use the :leading option to force the lines to have a fixed height, but this option seems to be ignored (or scaled down) when shrinking the text.

image

#column_box looked promising, but it doesn't look like there is a #row_box where the text flows vertically instead of horizontally. I also saw the GridBox class but am not sure how to use it. I also found the prawn-tables

Does Prawn have any text layout methods that can do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant