Class: Pdfrb::Content::GraphicsState::TextState

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfrb/content/graphics_state.rb

Overview

Text-specific sub-state (s9.3). Composed in GraphicsState.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(char_spacing: 0.0, word_spacing: 0.0, horizontal_scaling: 100.0, leading: 0.0, font_name: nil, font_size: 0.0, rendering_mode: 0, rise: 0.0, text_matrix: Pdfrb::Model::Matrix.identity, line_matrix: Pdfrb::Model::Matrix.identity) ⇒ TextState

Returns a new instance of TextState.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/pdfrb/content/graphics_state.rb', line 70

def initialize(char_spacing: 0.0, word_spacing: 0.0,
               horizontal_scaling: 100.0, leading: 0.0,
               font_name: nil, font_size: 0.0,
               rendering_mode: 0, rise: 0.0,
               text_matrix: Pdfrb::Model::Matrix.identity,
               line_matrix: Pdfrb::Model::Matrix.identity)
  @char_spacing = char_spacing.to_f
  @word_spacing = word_spacing.to_f
  @horizontal_scaling = horizontal_scaling.to_f
  @leading = leading.to_f
  @font_name = font_name
  @font_size = font_size.to_f
  @rendering_mode = rendering_mode.to_i
  @rise = rise.to_f
  @text_matrix = text_matrix
  @line_matrix = line_matrix
end

Instance Attribute Details

#char_spacingObject (readonly)

Returns the value of attribute char_spacing.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def char_spacing
  @char_spacing
end

#font_nameObject (readonly)

Returns the value of attribute font_name.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def font_name
  @font_name
end

#font_sizeObject (readonly)

Returns the value of attribute font_size.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def font_size
  @font_size
end

#horizontal_scalingObject (readonly)

Returns the value of attribute horizontal_scaling.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def horizontal_scaling
  @horizontal_scaling
end

#leadingObject (readonly)

Returns the value of attribute leading.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def leading
  @leading
end

#line_matrixObject (readonly)

Returns the value of attribute line_matrix.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def line_matrix
  @line_matrix
end

#rendering_modeObject (readonly)

Returns the value of attribute rendering_mode.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def rendering_mode
  @rendering_mode
end

#riseObject (readonly)

Returns the value of attribute rise.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def rise
  @rise
end

#text_matrixObject (readonly)

Returns the value of attribute text_matrix.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def text_matrix
  @text_matrix
end

#word_spacingObject (readonly)

Returns the value of attribute word_spacing.



66
67
68
# File 'lib/pdfrb/content/graphics_state.rb', line 66

def word_spacing
  @word_spacing
end

Instance Method Details

#to_hObject



92
93
94
95
96
97
98
99
100
# File 'lib/pdfrb/content/graphics_state.rb', line 92

def to_h
  {
    char_spacing: @char_spacing, word_spacing: @word_spacing,
    horizontal_scaling: @horizontal_scaling, leading: @leading,
    font_name: @font_name, font_size: @font_size,
    rendering_mode: @rendering_mode, rise: @rise,
    text_matrix: @text_matrix, line_matrix: @line_matrix
  }
end

#with(**overrides) ⇒ Object



88
89
90
# File 'lib/pdfrb/content/graphics_state.rb', line 88

def with(**overrides)
  TextState.new(**to_h.merge(overrides))
end