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.


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

def initialize
    self.reset
end

Instance Attribute Details

#char_spacingObject

Returns the value of attribute char_spacing


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

def char_spacing
  @char_spacing
end

#fontObject

Returns the value of attribute font


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

def font
  @font
end

#font_sizeObject

Returns the value of attribute font_size


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

def font_size
  @font_size
end

#leadingObject

Returns the value of attribute leading


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

def leading
  @leading
end

#rendering_modeObject

Returns the value of attribute rendering_mode


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

def rendering_mode
  @rendering_mode
end

#scalingObject

Returns the value of attribute scaling


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

def scaling
  @scaling
end

#text_knockoutObject

Returns the value of attribute text_knockout


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

def text_knockout
  @text_knockout
end

#text_line_matrixObject

Returns the value of attribute text_line_matrix


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

def text_line_matrix
  @text_line_matrix
end

#text_matrixObject

Returns the value of attribute text_matrix


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

def text_matrix
  @text_matrix
end

#text_rendering_matrixObject

Returns the value of attribute text_rendering_matrix


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

def text_rendering_matrix
  @text_rendering_matrix
end

#text_riseObject

Returns the value of attribute text_rise


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

def text_rise
  @text_rise
end

#word_spacingObject

Returns the value of attribute word_spacing


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

def word_spacing
  @word_spacing
end

Instance Method Details

#begin_text_objectObject


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

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


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

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:


80
81
82
# File 'lib/origami/graphics/text.rb', line 80

def is_in_text_object?
    @text_object
end

#resetObject


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

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