Sha256: 013d7ed1ac2e269fc44253727ad84505c257b67adf70d204832ee67c5d5bae8e

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

Prawn::Text::Formatted::Fragment.prepend (Module.new do
  attr_reader :document

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

  # Don't strip soft hyphens when repacking unretrieved fragments
  def include_trailing_white_space!
    @format_state.delete :normalized_soft_hyphen
    super
  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 = (val.end_with? 'em') ? val.to_f * @document.font_size : (@document.str_to_pt val) if ::String === val
    else
      val = super
    end
    if (border_offset = format_state[:border_offset])
      val += border_offset * 2
    end
    val
  end
end)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.6.2 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.6.1 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.6.0 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.4 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.3 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.2 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.1 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.rc.3 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.rc.2 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
asciidoctor-pdf-1.5.0.rc.1 lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb