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.



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/pdf/core/text.rb', line 234

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%.3f Tw" % amount
    yield
    add_content "\n%.3f Tw" % original_word_spacing
    @word_spacing = original_word_spacing
  end
end