Method: PDF::Core::Text#character_spacing

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

#character_spacing(amount = nil) ⇒ Object

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



216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/pdf/core/text.rb', line 216

def character_spacing(amount=nil)
  return defined?(@character_spacing) && @character_spacing || 0 if amount.nil?
  original_character_spacing = character_spacing
  if original_character_spacing == amount
    yield
  else
    @character_spacing = amount
    add_content "\n%.3f Tc" % amount
    yield
    add_content "\n%.3f Tc" % original_character_spacing
    @character_spacing = original_character_spacing
  end
end