Class: Origami::Text::State

Inherits:
Object
  • Object
show all
Defined in:
lib/origami/graphics/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



61
62
63
# File 'lib/origami/graphics/text.rb', line 61

def initialize
  self.reset
end

Instance Attribute Details

#char_spacingObject

Returns the value of attribute char_spacing.



54
55
56
# File 'lib/origami/graphics/text.rb', line 54

def char_spacing
  @char_spacing
end

#fontObject

Returns the value of attribute font.



55
56
57
# File 'lib/origami/graphics/text.rb', line 55

def font
  @font
end

#font_sizeObject

Returns the value of attribute font_size.



55
56
57
# File 'lib/origami/graphics/text.rb', line 55

def font_size
  @font_size
end

#leadingObject

Returns the value of attribute leading.



54
55
56
# File 'lib/origami/graphics/text.rb', line 54

def leading
  @leading
end

#rendering_modeObject

Returns the value of attribute rendering_mode.



56
57
58
# File 'lib/origami/graphics/text.rb', line 56

def rendering_mode
  @rendering_mode
end

#scalingObject

Returns the value of attribute scaling.



54
55
56
# File 'lib/origami/graphics/text.rb', line 54

def scaling
  @scaling
end

#text_knockoutObject

Returns the value of attribute text_knockout.



57
58
59
# File 'lib/origami/graphics/text.rb', line 57

def text_knockout
  @text_knockout
end

#text_line_matrixObject

Returns the value of attribute text_line_matrix.



59
60
61
# File 'lib/origami/graphics/text.rb', line 59

def text_line_matrix
  @text_line_matrix
end

#text_matrixObject

Returns the value of attribute text_matrix.



59
60
61
# File 'lib/origami/graphics/text.rb', line 59

def text_matrix
  @text_matrix
end

#text_rendering_matrixObject

Returns the value of attribute text_rendering_matrix.



59
60
61
# File 'lib/origami/graphics/text.rb', line 59

def text_rendering_matrix
  @text_rendering_matrix
end

#text_riseObject

Returns the value of attribute text_rise.



57
58
59
# File 'lib/origami/graphics/text.rb', line 57

def text_rise
  @text_rise
end

#word_spacingObject

Returns the value of attribute word_spacing.



54
55
56
# File 'lib/origami/graphics/text.rb', line 54

def word_spacing
  @word_spacing
end

Instance Method Details

#begin_text_objectObject



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/origami/graphics/text.rb', line 92

def begin_text_object
  if is_in_text_object?
    raise TextStateError, 
      "Cannot start a text object within an existing text object."
  end

  @text_object = true
  @text_matrix = 
  @text_line_matrix = 
  @text_rendering_matrix = Matrix.identity(3)
end

#end_text_objectObject



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/origami/graphics/text.rb', line 104

def end_text_object
  unless is_in_text_object?
    raise TextStateError, 
      "Cannot end text object : no previous text object has begun."
  end

  @text_object = false
  @text_matrix = 
  @text_line_matrix = 
  @text_rendering_matrix = nil
end

#is_in_text_object?Boolean

Returns:



88
89
90
# File 'lib/origami/graphics/text.rb', line 88

def is_in_text_object?
  @text_object
end

#resetObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/origami/graphics/text.rb', line 65

def reset
  
  @char_spacing = 0
  @word_spacing = 0
  @scaling = 100
  @leading = 0
  @font = nil
  @font_size = nil
  @rendering_mode = Rendering::FILL
  @text_rise = 0
  @text_knockout = true

  #
  # Text objects
  #

  @text_object = false
  @text_matrix = 
  @text_line_matrix = 
  @text_rendering_matrix = nil

end