Skip to content

Commit

Permalink
resolves asciidoctor#494 prevent inline SVG from changing document font
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Sep 6, 2016
1 parent 354b14e commit cc2afc1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ def render_behind fragment
image_left = fragment.left + ((fragment.width - data[:image_width]) / 2.0)
case data[:image_format]
when 'svg'
# prawn-svg messes with the cursor; use float as a workaround
pdf.float do
data[:image_obj].tap {|obj| obj.options[:at] = [image_left, image_top] }.draw
# prawn-svg messes with the font and cursor; use save_font and float, respectively, to workaround
pdf.save_font do
pdf.float do
data[:image_obj].tap {|obj| obj.options[:at] = [image_left, image_top] }.draw
end
end
else
pdf.embed_image data[:image_obj], data[:image_info], at: [image_left, image_top], width: data[:image_width]
Expand Down

0 comments on commit cc2afc1

Please sign in to comment.