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

Fixes #169. Text::Box :valign option. #788

Merged
merged 3 commits into from
Oct 17, 2014

Conversation

jessedoyle
Copy link
Contributor

Please see the comments in issue #169 for demonstrated changes.

@jessedoyle
Copy link
Contributor Author

This pull requests adds a :final_gap option to Prawn::Text::Formatted::Box.

This option defaults to true to match the current existing behaviour.

Vertical align centering is also changed slightly to calculate the top/bottom gaps based on the distance between the bottom of the box and the baseline of the text (as opposed to the descender).

Here's some output with the various options:
valign

@jessedoyle
Copy link
Contributor Author

@sandal: I removed the :final_gap option as you suggested.

This patch should make all text_boxes with :valign => :bottom render correctly without any padding on the bottom of the box.

I agree with your previous comments about fine-grained control over the location of rendered text.

As a Prawn user, I'd like to see padding options added with a format like:

 ... padding: { top: 10, bottom: 10, left: 5, right: 15 }, ...

Or:

 ... padding: 10, ...

to set the padding equally in all directions.

I would be willing to help implement these features, but I'll likely require assistance from someone more familiar with the codebase to do so.

@practicingruby
Copy link
Member

@jessedoyle: I'm trying to decide whether to add the padding options directly to text_box or to provide a higher level layout tool that is capable of doing this sort of thing.

I'm going to think on that for a few days, but if it becomes a big rats nest of a problem, we can think about merging your patch for a temporary solution.

practicingruby added a commit that referenced this pull request Oct 17, 2014
Fixes #169. Text::Box :valign option.
@practicingruby practicingruby merged commit 5a765ce into prawnpdf:master Oct 17, 2014
@practicingruby
Copy link
Member

@jessedoyle: I decided to merge this, because the concern about "how do we give better control over padding" seems to be orthogonal to the question of "how do we vertically align our text". Prawn's existing behavior was flawed for the latter, and your patch fixes that.

You already have commit access to Prawn, so in the future, please use a feature branch off of our main repository rather than your fork. That makes it easier for us to make revisions to a pull request if needed before merging while preserving the full history.

@practicingruby
Copy link
Member

@jessedoyle Thanks for this fix!

@jessedoyle
Copy link
Contributor Author

@sandal: I'll do that.

Thanks for being awesome and making Prawn!

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

Successfully merging this pull request may close these issues.

2 participants