Class: CTioga2::Graphics::Styles::BaseTextStyle

Inherits:
BasicStyle
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/texts.rb

Overview

The style of a text object. This class is suitable for inclusion as a Hash to FigureMaker#show_axis, for the tick labels.

Direct Known Subclasses

FullTextStyle

Constant Summary

Constants inherited from BasicStyle

CTioga2::Graphics::Styles::BasicStyle::OldAttrAccessor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicStyle

attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other

Instance Attribute Details

#alignementObject

The vertical alignment



43
44
45
# File 'lib/ctioga2/graphics/styles/texts.rb', line 43

def alignement
  @alignement
end

#angleObject

The angle of the text



32
33
34
# File 'lib/ctioga2/graphics/styles/texts.rb', line 32

def angle
  @angle
end

#justificationObject

The horizontal alignment



46
47
48
# File 'lib/ctioga2/graphics/styles/texts.rb', line 46

def justification
  @justification
end

#scaleObject

The scale of the text



40
41
42
# File 'lib/ctioga2/graphics/styles/texts.rb', line 40

def scale
  @scale
end

#shiftObject

The ‘shift’ of the text. Only meaningful for axes and tick labels, where the position of the text is specified using a side rather than a precise position



37
38
39
# File 'lib/ctioga2/graphics/styles/texts.rb', line 37

def shift
  @shift
end

Instance Method Details

#draw_text(t, text, x_or_loc, y = nil, measure = nil) ⇒ Object

Draw the text at the given location with the given style. If y is nil, then x_or_loc is taken to be a location (see FigureMaker#show_text).



51
52
53
54
# File 'lib/ctioga2/graphics/styles/texts.rb', line 51

def draw_text(t, text, x_or_loc, y = nil, measure = nil)
  dict = prepare_show_text_dict(text, x_or_loc, y, measure)
  t.show_text(dict)
end