FreeMat: vtkTextActor

FreeMat

- Main Page
- Related Pages

vtkTextActor

Section: Visualization Toolkit Rendering Classes

# Usage

vtkTextActor can be used to place text annotation into a window. When TextScaleMode is NONE, the text is fixed font and operation is the same as a vtkPolyDataMapper2D/vtkActor2D pair. When TextScaleMode is VIEWPORT, the font resizes such that it maintains a consistent size relative to the viewport in which it is rendered. When TextScaleMode is PROP, the font resizes such that the text fits inside the box defined by the position 1 & 2 coordinates. This class replaces the deprecated vtkScaledTextActor and acts as a convenient wrapper for a vtkTextMapper/vtkActor2D pair. Set the text property/attributes through the vtkTextProperty associated to this actor.

To create an instance of class vtkTextActor, simply invoke its constructor as follows

      obj = vtkTextActor

# Methods

The class vtkTextActor has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkTextActor class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkTextActor = obj.NewInstance ()`
- `vtkTextActor = obj.SafeDownCast (vtkObject o)`
- `obj.ShallowCopy (vtkProp prop)` - Shallow copy of this text actor. Overloads the virtual vtkProp method.
- `obj.SetMapper (vtkPolyDataMapper2D mapper)` - Override the vtkPolyDataMapper2D that defines the text to be drawn. One will be created by default if none is supplied
- `obj.SetInput (string inputString)` - Set the text string to be displayed. "\n" is recognized as a carriage return/linefeed (line separator). Only 7-bit ASCII is allowed (anything else, such as Latin1 or UTF8, is not acceptable). Convenience method to the underlying mapper
- `string = obj.GetInput ()` - Set the text string to be displayed. "\n" is recognized as a carriage return/linefeed (line separator). Only 7-bit ASCII is allowed (anything else, such as Latin1 or UTF8, is not acceptable). Convenience method to the underlying mapper
- `obj.SetMinimumSize (int , int )` - Set/Get the minimum size in pixels for this actor. Defaults to 10,10. Only valid when TextScaleMode is PROP.
- `obj.SetMinimumSize (int a[2])` - Set/Get the minimum size in pixels for this actor. Defaults to 10,10. Only valid when TextScaleMode is PROP.
- `int = obj. GetMinimumSize ()` - Set/Get the minimum size in pixels for this actor. Defaults to 10,10. Only valid when TextScaleMode is PROP.
- `obj.SetMaximumLineHeight (float )` - Set/Get the maximum height of a line of text as a percentage of the vertical area allocated to this scaled text actor. Defaults to 1.0. Only valid when TextScaleMode is PROP.
- `float = obj.GetMaximumLineHeight ()` - Set/Get the maximum height of a line of text as a percentage of the vertical area allocated to this scaled text actor. Defaults to 1.0. Only valid when TextScaleMode is PROP.
- `obj.SetTextScaleMode (int )` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `int = obj.GetTextScaleModeMinValue ()` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `int = obj.GetTextScaleModeMaxValue ()` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `int = obj.GetTextScaleMode ()` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `obj.SetTextScaleModeToNone ()` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `obj.SetTextScaleModeToProp ()` - Set how text should be scaled. If set to vtkTextActor::TEXT_SCALE_MODE_NONE, the the font size will be fixed by the size given in TextProperty. If set to vtkTextActor::TEXT_SCALE_MODE_PROP, the text will be scaled to fit exactly in the prop as specified by the position 1 & 2 coordinates. If set to vtkTextActor::TEXT_SCALE_MODE_VIEWPORT, the text will be scaled based on the size of the viewport it is displayed in.
- `obj.SetTextScaleModeToViewport ()` - DO NOT CALL. Deprecated in VTK 5.4. Use SetTextScaleMode or GetTextScaleMode instead.
- `obj.SetScaledText (int )` - DO NOT CALL. Deprecated in VTK 5.4. Use SetTextScaleMode or GetTextScaleMode instead.
- `int = obj.GetScaledText ()` - DO NOT CALL. Deprecated in VTK 5.4. Use SetTextScaleMode or GetTextScaleMode instead.
- `obj.ScaledTextOn ()` - DO NOT CALL. Deprecated in VTK 5.4. Use SetTextScaleMode or GetTextScaleMode instead.
- `obj.ScaledTextOff ()` - DO NOT CALL. Deprecated in VTK 5.4. Use SetTextScaleMode or GetTextScaleMode instead.
- `obj.SetUseBorderAlign (int )` - Turn on or off the UseBorderAlign option. When UseBorderAlign is on, the bounding rectangle is used to align the text, which is the proper behavior when using vtkTextRepresentation
- `int = obj.GetUseBorderAlign ()` - Turn on or off the UseBorderAlign option. When UseBorderAlign is on, the bounding rectangle is used to align the text, which is the proper behavior when using vtkTextRepresentation
- `obj.UseBorderAlignOn ()` - Turn on or off the UseBorderAlign option. When UseBorderAlign is on, the bounding rectangle is used to align the text, which is the proper behavior when using vtkTextRepresentation
- `obj.UseBorderAlignOff ()` - Turn on or off the UseBorderAlign option. When UseBorderAlign is on, the bounding rectangle is used to align the text, which is the proper behavior when using vtkTextRepresentation
- `obj.SetAlignmentPoint (int point)` - This method is being depricated. Use SetJustification and SetVerticalJustification in text property instead. Set/Get the Alignment point if zero (default), the text aligns itself to the bottom left corner (which is defined by the PositionCoordinate) otherwise the text aligns itself to corner/midpoint or centre

            6   7   8
            3   4   5
            0   1   2

  This is the same as setting the TextProperty's justification. Currently TextActor is not oriented around its AlignmentPoint.
- `int = obj.GetAlignmentPoint ()` - This method is being depricated. Use SetJustification and SetVerticalJustification in text property instead. Set/Get the Alignment point if zero (default), the text aligns itself to the bottom left corner (which is defined by the PositionCoordinate) otherwise the text aligns itself to corner/midpoint or centre

            6   7   8
            3   4   5
            0   1   2

  This is the same as setting the TextProperty's justification. Currently TextActor is not oriented around its AlignmentPoint.
- `obj.SetOrientation (float orientation)` - Counterclockwise rotation around the Alignment point. Units are in degrees and defaults to 0. The orientation in the text property rotates the text in the texture map. It will proba ly not give you the effect you desire.
- `float = obj.GetOrientation ()` - Counterclockwise rotation around the Alignment point. Units are in degrees and defaults to 0. The orientation in the text property rotates the text in the texture map. It will proba ly not give you the effect you desire.
- `obj.SetTextProperty (vtkTextProperty p)` - Set/Get the text property.
- `vtkTextProperty = obj.GetTextProperty ()` - Set/Get the text property.
- `obj.SetNonLinearFontScale (double exponent, int target)` - Enable non-linear scaling of font sizes. This is useful in combination with scaled text. With small windows you want to use the entire scaled text area. With larger windows you want to reduce the font size some so that the entire area is not used. These values modify the computed font size as follows: newFontSize = pow(FontSize,exponent)*pow(target,1.0 - exponent) typically exponent should be around 0.7 and target should be around 10
- `obj.SpecifiedToDisplay (double pos, vtkViewport vport, int specified)` - This is just a simple coordinate conversion method used in the render process.
- `obj.DisplayToSpecified (double pos, vtkViewport vport, int specified)` - This is just a simple coordinate conversion method used in the render process.
- `obj.ComputeScaledFont (vtkViewport viewport)` - Compute the scale the font should be given the viewport. The result is placed in the ScaledTextProperty ivar.
- `vtkTextProperty = obj.GetScaledTextProperty ()` - Get the scaled font. Use ComputeScaledFont to set the scale for a given viewport.