Module: Prawn::Core::Text

Included in:
Text
Defined in:
lib/prawn/core/text.rb

Overview

:nodoc:

Constant Summary collapse

VALID_OPTIONS =

These should be used as a base. Extensions may build on this list

[:kerning, :size, :style]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#skip_encodingObject (readonly)

Returns the value of attribute skip_encoding.



20
21
22
# File 'lib/prawn/core/text.rb', line 20

def skip_encoding
  @skip_encoding
end

#text_optionsObject (readonly)

Returns the value of attribute text_options.



19
20
21
# File 'lib/prawn/core/text.rb', line 19

def text_options
  @text_options
end

Instance Method Details

#draw_text!(text, options) ⇒ Object

Low level text placement method. All font and size alterations should already be set



25
26
27
28
# File 'lib/prawn/core/text.rb', line 25

def draw_text!(text, options)
  x,y = map_to_absolute(options[:at])
  add_text_content(text,x,y,options)
end

#process_text_options(options) ⇒ Object

Low level call to set the current font style and extract text options from an options hash. Should be called from within a save_font block



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/prawn/core/text.rb', line 33

def process_text_options(options)
  if options[:style]
    raise "Bad font family" unless font.family
    font(font.family, :style => options[:style])
  end

  # must compare against false to keep kerning on as default
  unless options[:kerning] == false
    options[:kerning] = font.has_kerning_data?
  end

  options[:size] ||= font_size
end