Class: CTioga2::Graphics::Styles::BaseTextStyle
- Inherits:
-
BasicStyle
- Object
- BasicStyle
- CTioga2::Graphics::Styles::BaseTextStyle
- Defined in:
- lib/ctioga2/graphics/styles/texts.rb
Overview
TODO:
alignement and justification are poor names. halign
The style of a text object. This class is suitable for inclusion as a Hash to FigureMaker#show_axis, for the tick labels.
and/or valign would be better.
Direct Known Subclasses
Constant Summary
Constants inherited from BasicStyle
CTioga2::Graphics::Styles::BasicStyle::AllStyles, CTioga2::Graphics::Styles::BasicStyle::OldAttrAccessor
Instance Method Summary collapse
-
#draw_text(t, text, x_or_loc, y = nil, measure = nil) ⇒ Object
Draw the text at the given location with the given style.
- #hash_for_tioga(t) ⇒ Object
- #scale_dy(t) ⇒ Object
- #shift_dy(t) ⇒ Object
Methods inherited from BasicStyle
attr_accessor, attribute_type, attribute_types, attributes, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other
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).
56 57 58 59 60 61 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 56 def draw_text(t, text, x_or_loc, y = nil, measure = nil) t.context do dict = prepare_show_text_dict(t, text, x_or_loc, y, measure) t.show_text(dict) end end |
#hash_for_tioga(t) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 77 def hash_for_tioga(t) dict = self.to_hash if dict.key? 'shift' dim = dict['shift'] dict['shift'] = dim.to_dy(t) end if dict.key? 'scale' dim = dict['scale'] dict['scale'] = dim.to_dy(t) end dict.delete('text_width') return dict end |
#scale_dy(t) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 70 def scale_dy(t) if @scale return @scale.to_dy(t) end return nil end |
#shift_dy(t) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 63 def shift_dy(t) if @shift return @shift.to_dy(t) end return nil end |