Class: PDF::Inspector::Text

Inherits:
PDF::Inspector show all
Defined in:
lib/pdf/inspector/text.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from PDF::Inspector

analyze, analyze_file, parse

Constructor Details

- (Text) initialize



8
9
10
11
12
13
14
15
16
# File 'lib/pdf/inspector/text.rb', line 8

def initialize     
  @font_settings = []
  @fonts = {}
  @strings = []
  @character_spacing = []
  @word_spacing = []
  @kerned = []
  @text_rendering_mode = []
end

Instance Attribute Details

- (Object) character_spacing

Returns the value of attribute character_spacing



5
6
7
# File 'lib/pdf/inspector/text.rb', line 5

def character_spacing
  @character_spacing
end

- (Object) font_settings

Returns the value of attribute font_settings



4
5
6
# File 'lib/pdf/inspector/text.rb', line 4

def font_settings
  @font_settings
end

- (Object) kerned

Returns the value of attribute kerned



6
7
8
# File 'lib/pdf/inspector/text.rb', line 6

def kerned
  @kerned
end

- (Object) size

Returns the value of attribute size



4
5
6
# File 'lib/pdf/inspector/text.rb', line 4

def size
  @size
end

- (Object) strings

Returns the value of attribute strings



4
5
6
# File 'lib/pdf/inspector/text.rb', line 4

def strings
  @strings
end

- (Object) text_rendering_mode

Returns the value of attribute text_rendering_mode



6
7
8
# File 'lib/pdf/inspector/text.rb', line 6

def text_rendering_mode
  @text_rendering_mode
end

- (Object) word_spacing

Returns the value of attribute word_spacing



5
6
7
# File 'lib/pdf/inspector/text.rb', line 5

def word_spacing
  @word_spacing
end

Instance Method Details

- (Object) resource_font(*params)



18
19
20
# File 'lib/pdf/inspector/text.rb', line 18

def resource_font(*params)
  @fonts[params[0]] = params[1].basefont
end

- (Object) set_character_spacing(*params)



41
42
43
# File 'lib/pdf/inspector/text.rb', line 41

def set_character_spacing(*params)
  @character_spacing << params[0]
end

- (Object) set_text_font_and_size(*params)



22
23
24
# File 'lib/pdf/inspector/text.rb', line 22

def set_text_font_and_size(*params)     
  @font_settings << { :name => @fonts[params[0]], :size => params[1] }
end

- (Object) set_text_rendering_mode(*params)



37
38
39
# File 'lib/pdf/inspector/text.rb', line 37

def set_text_rendering_mode(*params)
  @text_rendering_mode << params[0]
end

- (Object) set_word_spacing(*params)



45
46
47
# File 'lib/pdf/inspector/text.rb', line 45

def set_word_spacing(*params)
  @word_spacing << params[0]
end

- (Object) show_text(*params)



26
27
28
29
# File 'lib/pdf/inspector/text.rb', line 26

def show_text(*params)
  @kerned << false
  @strings << params[0]
end

- (Object) show_text_with_positioning(*params)



31
32
33
34
35
# File 'lib/pdf/inspector/text.rb', line 31

def show_text_with_positioning(*params)      
  @kerned << true
  # ignore kerning information
  @strings << params[0].reject { |e| Numeric === e }.join
end