class Rouge::Formatters::Prawn::BackgroundColorizer
Public Class Methods
new(opts = {})
click to toggle source
# File lib/asciidoctor/pdf/ext/rouge/formatters/prawn.rb, line 184 def initialize opts = {} @line_gap = opts[:line_gap] || 0 end
Public Instance Methods
render_behind(fragment)
click to toggle source
# File lib/asciidoctor/pdf/ext/rouge/formatters/prawn.rb, line 188 def render_behind fragment pdf = fragment.document data = fragment.format_state prev_fill_color = pdf.fill_color pdf.fill_color data[:background_color] if data[:inline_block] fragment_width = data[:extend] ? pdf.bounds.width - fragment.left : fragment.width v_gap = @line_gap else fragment_width = fragment.width v_gap = 0 end pdf.fill_rectangle [fragment.left, fragment.top + v_gap * 0.5], fragment_width, (fragment.height + v_gap) pdf.fill_color prev_fill_color fragment.conceal if fragment.text == DummyText nil end