diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-05-13 16:45:34 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-05-13 16:45:34 -0600 |
| commit | beda8e52a472a7d8e394f5bc964d7c311afabb32 (patch) | |
| tree | e446fd38e61bdec299b1304867941cffe506bb48 | |
| parent | 926cb9e627c41c08729a008dd5ce661e13aaed89 (diff) | |
use instance variable to store force_justify value
| -rw-r--r-- | lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb b/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb index cb211072..2ed33ca5 100644 --- a/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb +++ b/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb @@ -14,7 +14,7 @@ Prawn::Text::Formatted::Box.prepend (Module.new do @bottom_gutter = bottom_gutter extend Prawn::Text::Formatted::ProtectBottomGutter end - @options[:force_justify] = true if options[:force_justify] + @force_justify = options[:force_justify] end def draw_fragment_overlay_styles fragment @@ -77,7 +77,7 @@ Prawn::Text::Formatted::Box.prepend (Module.new do # Override method to force text justification when :force_justify option is set (typically for rendering a single line) def word_spacing_for_this_line - if @align == :justify && (@options[:force_justify] || (@line_wrap.space_count > 0 && !@line_wrap.paragraph_finished?)) + if @align == :justify && (@force_justify || (@line_wrap.space_count > 0 && !@line_wrap.paragraph_finished?)) (available_width - @line_wrap.width) / @line_wrap.space_count else 0 |
