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.



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

def initialize
  reset
end

Instance Attribute Details

#char_spacingObject

Returns the value of attribute char_spacing.



46
47
48
# File 'lib/origami/graphics/text.rb', line 46

def char_spacing
  @char_spacing
end

#fontObject

Returns the value of attribute font.



47
48
49
# File 'lib/origami/graphics/text.rb', line 47

def font
  @font
end

#font_sizeObject

Returns the value of attribute font_size.



47
48
49
# File 'lib/origami/graphics/text.rb', line 47

def font_size
  @font_size
end

#leadingObject

Returns the value of attribute leading.



46
47
48
# File 'lib/origami/graphics/text.rb', line 46

def leading
  @leading
end

#rendering_modeObject

Returns the value of attribute rendering_mode.



48
49
50
# File 'lib/origami/graphics/text.rb', line 48

def rendering_mode
  @rendering_mode
end

#scalingObject

Returns the value of attribute scaling.



46
47
48
# File 'lib/origami/graphics/text.rb', line 46

def scaling
  @scaling
end

#text_knockoutObject

Returns the value of attribute text_knockout.



49
50
51
# File 'lib/origami/graphics/text.rb', line 49

def text_knockout
  @text_knockout
end

#text_line_matrixObject

Returns the value of attribute text_line_matrix.



51
52
53
# File 'lib/origami/graphics/text.rb', line 51

def text_line_matrix
  @text_line_matrix
end

#text_matrixObject

Returns the value of attribute text_matrix.



51
52
53
# File 'lib/origami/graphics/text.rb', line 51

def text_matrix
  @text_matrix
end

#text_rendering_matrixObject

Returns the value of attribute text_rendering_matrix.



51
52
53
# File 'lib/origami/graphics/text.rb', line 51

def text_rendering_matrix
  @text_rendering_matrix
end

#text_riseObject

Returns the value of attribute text_rise.



49
50
51
# File 'lib/origami/graphics/text.rb', line 49

def text_rise
  @text_rise
end

#word_spacingObject

Returns the value of attribute word_spacing.



46
47
48
# File 'lib/origami/graphics/text.rb', line 46

def word_spacing
  @word_spacing
end

Instance Method Details

#begin_text_objectObject



82
83
84
85
86
87
88
89
90
91
# File 'lib/origami/graphics/text.rb', line 82

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



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

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:



78
79
80
# File 'lib/origami/graphics/text.rb', line 78

def is_in_text_object?
  @text_object
end

#resetObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/origami/graphics/text.rb', line 57

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