-
Notifications
You must be signed in to change notification settings - Fork 688
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
Hyphenation character rendered in last line of each paragraph of column_box #347
Comments
Thanks for the report Michael. Just to clarify - are you saying that the hyphens on the final line of the first column aren't being rendered? I just tested this against prawn master and I can't reproduce it. I'll close the issue for now, but if you're able to provide more information please feel free to re-open it! |
Yob, sorry getting back to your response after such a long time. What I am saying is, that the hyphen character is being rendered, if the hyphenated word is printed in the last line of a column. Obviously, that shouldn't happen. I've checked on ruby 1.8.7 and 2.0.0 – with prawn 1.0.0 rc1 and prawn 1.0.0 rc2. Here's my short code to reproduce the problem: hyphentest.rb require 'prawn'
class Hyphen < Prawn::Document
def initialize
super(:margin => [10,10,10,10], :page_size => 'A4')
column_box([0, cursor], columns: 2, width: bounds.width) do
text "This is a test where the very important Hy#{Prawn::Text::SHY}phe#{Prawn::Text::SHY}na#{Prawn::Text::SHY}tion works fine here, but which contains Hy#{Prawn::Text::SHY}phe#{Prawn::Text::SHY}na#{Prawn::Text::SHY}tion\n in the last line of the paragraph Hy#{Prawn::Text::SHY}phe#{Prawn::Text::SHY}na#{Prawn::Text::SHY}ted\n"
bounds.move_past_bottom
text "second column"
end
end
end
Hyphen.new.render_file('hyphentest.pdf') |
Thanks @mkastner. Simpler test case reproducing and clarifying the issue: Prawn::Document.generate('test.pdf') do
content = "blah " * 20 + "Hy#{Prawn::Text::SHY}phe#{Prawn::Text::SHY}na#{Prawn::Text::SHY}tion"
text(content) # hyphenated correctly
text("#{content}\n") # hyphenated incorrectly
end Lines ending in From reading the code, this appears to be caused by the fact that @Bluejade, can you clarify the purpose of Thanks! |
I don't know if this is a variant of the same problem, but consider the following: class Hyphen < Prawn::Document
def initialize
super
content = "blah " * 20 + "Hy#{Prawn::Text::SHY}phe#{Prawn::Text::SHY}na#{Prawn::Text::SHY}tion"
formatted_text([{text: content}, {text: content}])
end
end In this one, the word "Hyphenation" from the first hash incorrectly shows all hyphens, but "Hyphenation" from the second hash does not. I mention it only because this does not involve a carriage return. |
I suspect it is the same issue. My guess is "exclude_trailing_white_space? only gets set for the last hash in a formatted_text array (probably because trailing whitespace is only an issue at the end of the paragraph). No longer skipping soft-hyphen processing when :exclude_trailing_white_space? is false ought to solve this problem too. |
Hello Brad, I'll have to re-familiarize myself with that code and get back to you. Best, Daniel
|
I don't fully understand this issue, but it appears to still exist in 1.0.0 so I'm reopening for further commentary and discussion. |
Is there any hope that this issue may be addressed soonish? |
@no-dashes: Sure, investigate, add additional research to the ticket, and optionally a patch. We'll be able to help answer questions about the code if you have any. |
@no-dashes: Can you try the code on #773 and see if it fixes your problem? |
@sandal: Well... @Mario1988 tried to fix the problem we had with this bug. So yeah, I confirm it fixes the bug for us. |
@no-dashes: Great, hopefully we'll get this merged and released soon, then. |
I've merged a revised version of @Mario1988's patch in master! |
Hi,
it seems like I ran into a problem with hyphenation. If a word in the last line of a paragraph within a column_box contains hyphenation characters, they are being rendered.
Everything regarding hyphenation works fine in any other line but when it comes to the last line of the paragraph, the issue arises.
I've placed a simple example code in this gist, which reproduces the problem (I'm using ruby 1.9.3 on mac and freebsd):
https://gist.github.com/2547562
BTW: thanks for all your great work with prawn!
Michael
The text was updated successfully, but these errors were encountered: