Method: PDF::Core::Text#word_spacing

Defined in:
lib/pdf/core/text.rb

#word_spacing(amount = nil) ⇒ Object

Increases or decreases the space between words. For horizontal text, a positive value will increase the space. For veritical text, a positive value will decrease the space.



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/pdf/core/text.rb', line 241

def word_spacing(amount = nil)
  return defined?(@word_spacing) && @word_spacing || 0 if amount.nil?

  original_word_spacing = word_spacing
  if original_word_spacing == amount
    yield
  else
    @word_spacing = amount
    add_content "\n#{PDF::Core.real(amount)} Tw"
    yield
    add_content "\n#{PDF::Core.real(original_word_spacing)} Tw"

    @word_spacing = original_word_spacing
  end
end