Sha256: 7057494dee9504305c55692a1e8a09daeffb41e62c6fb6f153caf8c9fa038a3b

Contents?: true

Size: 566 Bytes

Versions: 11

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

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) && (gap_width = fragment.width - (document.width_of text)) != 0
        x += gap_width * (align == :center ? 0.5 : 1)
      end
      document.draw_text! text, at: [x, y]
      fragment.conceal
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
asciidoctor-pdf-2.0.4 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.3 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.2 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.1 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.rc.1 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.beta.2 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.beta.1 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.alpha.3 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.alpha.2 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb
asciidoctor-pdf-2.0.0.alpha.1 lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb