Sha256: e69b71f741dcd11e042aaa5623ffed780333185f77a22e3f0fe88d70ff891b62

Contents?: true

Size: 870 Bytes

Versions: 3

Compression:

Stored size: 870 Bytes

Contents

module Asciidoctor
module Prawn
module FormattedText
module Fragment
  attr_reader :document

  # Prevent fragment from being written by discarding the text.
  def conceal
    @text = ''
  end

  # Modify the built-in ascender write method to allow an override value to be
  # specified using the format_state hash.
  def ascender= val
    @ascender = (format_state.key? :ascender) ? format_state[:ascender] : val
  end

  # Modify the built-in ascender write method to allow an override value to be
  # specified using the format_state hash.
  def descender= val
    @descender = (format_state.key? :descender) ? format_state[:descender] : val
  end

  def width
    if (val = format_state[:width])
      (val.end_with? 'em') ? val.to_f * @document.font_size : val
    else
      super
    end
  end
end

::Prawn::Text::Formatted::Fragment.prepend Fragment
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/prawn_ext/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.alpha.18 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.alpha.17 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb