diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2023-06-27 01:41:12 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2023-06-27 01:41:12 -0600 |
| commit | ee40e0088ad384651ab9d344d08ad77cb8aa6069 (patch) | |
| tree | 0cc3a212d4ee596a719a0730770318bdf8027260 | |
| parent | b298e8cbd61ce7ff311e08d4b25ef1c445502d1b (diff) | |
consolidate calculation of left position in convert_image
| -rw-r--r-- | lib/asciidoctor/pdf/converter.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb index d48ab392..e3542a34 100644 --- a/lib/asciidoctor/pdf/converter.rb +++ b/lib/asciidoctor/pdf/converter.rb @@ -1831,14 +1831,13 @@ module Asciidoctor update_colors if graphic_state.color_space.empty? ink_caption node, category: :image, end: :top, block_align: alignment, block_width: rendered_w, max_width: caption_max_width if caption_end == :top && node.title? image_y = y + left = bounds.left # NOTE: prawn-svg does not compute :at for alignment correctly in column box, so resort to our own logic case alignment when :center - left = bounds.left + (available_w - rendered_w) * 0.5 + left += (available_w - rendered_w) * 0.5 when :right - left = bounds.left + available_w - rendered_w - else - left = bounds.left + left += available_w - rendered_w end svg_obj.options[:at] = [left, (image_cursor = cursor)] svg_obj.draw # NOTE: cursor advances automatically |
