Sha256: a97dd0a7dc8e660a3c320130a9f90984fd3f16b71cf52d6cb7764656403abc73

Contents?: true

Size: 900 Bytes

Versions: 4

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true
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

4 entries across 4 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.beta.5 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.beta.4 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.beta.3 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.beta.2 lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb