Sha256: ee09edc449c162db481804776e1601b01c4019d88412cc68204f0dc326f19f54

Contents?: true

Size: 521 Bytes

Versions: 3

Compression:

Stored size: 521 Bytes

Contents

module Asciidoctor::PDF::FormattedText
module InlineTextAligner
  module_function

  def render_behind fragment
    document = fragment.document
    text = fragment.text
    x = fragment.left
    y = fragment.baseline
    align = fragment.format_state[:align]
    if align == :center || align == :right
      if (gap_width = fragment.width - (document.width_of text)) != 0
        x += gap_width * (align == :center ? 0.5 : 1)
      end
    end
    document.draw_text! text, at: [x, y]
    fragment.conceal
  end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.beta.1 lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-1.5.0.alpha.18 lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-1.5.0.alpha.17 lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb