public class SoTextProperty extends SoNode
The application can specify text alignment and orientation using the alignmentH
, alignmentV
, and orientation
fields.
Note:
Horizontal alignment can also be specified in some text nodes, for example SoText2
and SoText3
, using the
justification field. The value in the text node's field is used unless that field is explicitly set to INHERIT. To allow SoTextProperty
to control horizontal justification, set the text node's justification field to INHERITED.
The application can also request use of font kerning using the kerning
field. Kerning consists of modifying the spacing between two successive glyphs according to their outlines. For examples, a "T" and a "y" can be moved closer together as the top of the "y" fits nicely under the upper right bar of the "T". Kerning depends on the specific font being used.
Different text rendering styles such as underline, strikethrough and background rectangle can be specified using the style
field. A color can be specified for each style using the styleColors
field. The current material does not affect the color of a text rendering style unless the corresponding value in the styleColorsUseCurrentMaterial
field is set to true. Text rendering styles apply to the entire string.
File format/default:
TextProperty {
Action behavior:
Sets:
See also:
Notes:
Text rendering effects
SoMaterial
controls both the text and the lines.
Accumulation mode (enableTextAccumulation
) significantly improves performance for scene graphs containing many SoText3
nodes. There are some drawbacks and limitations.
}
aliasingFactor 1.0
alignmentH LEFT
alignmentV BASE
backFrameLineWidth 0.0
enableTextAccumulation false
kerning false
margin 0.0
orientation LEFT_TO_RIGHT
textureQualityRange 150 300
style NONE
styleColors 0.8 0.8 0.8 1
styleColorsUseCurrentMaterial false
SoTextAlignmentHElement
, SoTextAlignmentVElement
, SoTextBackFrameLineWidthElement
, SoTextOrientationElement
, SoTextKerningElement
, SoTextMarginElement
Modifier and Type | Class and Description |
---|---|
static class |
SoTextProperty.AlignmentHs
Possible horizontal alignment values.
|
static class |
SoTextProperty.AlignmentVs
Possible vertical alignment values.
|
static class |
SoTextProperty.Orientations
Possible text orientation values.
|
static class |
SoTextProperty.StyleColorType
Index values for setting colors in the
styleColors field. |
static class |
SoTextProperty.Styles
TextProperty style values.
|
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFFloat |
aliasingFactor
Defines the anti-aliasing factor to apply to the textured text rendering.
|
SoSFEnum<SoTextProperty.AlignmentHs> |
alignmentH
Indicates horizontal placement and alignment of strings.
|
SoSFEnum<SoTextProperty.AlignmentVs> |
alignmentV
Indicates vertical placement and alignment of strings.
|
static int |
BACK_FRAME
Deprecated.
Use
SoTextProperty.Styles.BACK_FRAME instead. |
static int |
BACK_FRAME_COLOR
Deprecated.
Use
SoTextProperty.StyleColorType.BACK_FRAME_COLOR instead. |
static int |
BACK_FRAME_LINE
Deprecated.
Use
SoTextProperty.Styles.BACK_FRAME_LINE instead. |
static int |
BACK_FRAME_LINE_COLOR
Deprecated.
Use
SoTextProperty.StyleColorType.BACK_FRAME_LINE_COLOR instead. |
SoSFFloat |
backFrameLineWidth
Defines the width of the line when BACK_FRAME_LINE has been enabled for the current style.
|
static int |
BASE
Deprecated.
Use
SoTextProperty.AlignmentVs.BASE instead. |
static int |
BOTTOM
Deprecated.
Use
SoTextProperty.AlignmentVs.BOTTOM instead. |
static int |
BOTTOM_TO_TOP
Deprecated.
Use
SoTextProperty.Orientations.BOTTOM_TO_TOP instead. |
static int |
CENTER
Deprecated.
Use
SoTextProperty.AlignmentHs.CENTER instead. |
SoSFFloat |
characterSpacing
This field specifies the spacing between individual characters.
|
static int |
DOUBLE_STRIKETHROUGH
Deprecated.
Use
SoTextProperty.Styles.DOUBLE_STRIKETHROUGH instead. |
static int |
DOUBLE_STRIKETHROUGH_COLOR
Deprecated.
|
SoSFBool |
enableTextAccumulation
Enables the
accumulation rendering mode for
SoText3 nodes. |
static int |
HALF
Deprecated.
Use
SoTextProperty.AlignmentVs.HALF instead. |
SoSFBool |
kerning
Set this field to true to apply kerning on text rendering.
|
static int |
LEFT
Deprecated.
Use
SoTextProperty.AlignmentHs.LEFT instead. |
static int |
LEFT_TO_RIGHT
Deprecated.
Use
SoTextProperty.Orientations.LEFT_TO_RIGHT instead. |
SoSFFloat |
margin
Set a margin (extra space) to apply around the text string for the BACK_FRAME and BACK_FRAME_LINE styles.
|
static int |
NONE
Deprecated.
Use
SoTextProperty.Styles.NONE instead. |
static int |
NUM_EFFECTS_COLORS
Deprecated.
Use
SoTextProperty.StyleColorType.NUM_EFFECTS_COLORS instead. |
SoSFEnum<SoTextProperty.Orientations> |
orientation
Specifies the text rendering orientation.
|
static int |
OVERLINE
Deprecated.
Use
SoTextProperty.Styles.OVERLINE instead. |
static int |
OVERLINE_COLOR
Deprecated.
Use
SoTextProperty.StyleColorType.OVERLINE_COLOR instead. |
static int |
RIGHT
Deprecated.
Use
SoTextProperty.AlignmentHs.RIGHT instead. |
static int |
RIGHT_TO_LEFT
Deprecated.
Use
SoTextProperty.Orientations.RIGHT_TO_LEFT instead. |
static int |
STRIKETHROUGH
Deprecated.
Use
SoTextProperty.Styles.STRIKETHROUGH instead. |
static int |
STRIKETHROUGH_COLOR
Deprecated.
Use
SoTextProperty.StyleColorType.STRIKETHROUGH_COLOR instead. |
SoSFBitMask<SoTextProperty.Styles> |
style
Specifies zero or more styles to be applied to text.
|
SoMFColorRGBA |
styleColors
Specifies the color to use for each style.
|
SoMFBool |
styleColorsUseCurrentMaterial
This field allows to use the current
SoMaterial instead of the value specified by styleColors for each available style (default gray). |
SoSFVec2i32 |
textureQualityRange
Defines a quality range of values taken into account during textured text texture computation.
|
static int |
TOP
Deprecated.
Use
SoTextProperty.AlignmentVs.TOP instead. |
static int |
TOP_TO_BOTTOM
Deprecated.
Use
SoTextProperty.Orientations.TOP_TO_BOTTOM instead. |
static int |
UNDERLINE
Deprecated.
Use
SoTextProperty.Styles.UNDERLINE instead. |
static int |
UNDERLINE_COLOR
Deprecated.
Use
SoTextProperty.StyleColorType.UNDERLINE_COLOR instead. |
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoTextProperty()
Text property constructor.
|
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int LEFT
SoTextProperty.AlignmentHs.LEFT
instead.@Deprecated public static final int CENTER
SoTextProperty.AlignmentHs.CENTER
instead.@Deprecated public static final int RIGHT
SoTextProperty.AlignmentHs.RIGHT
instead.@Deprecated public static final int TOP
SoTextProperty.AlignmentVs.TOP
instead.@Deprecated public static final int HALF
SoTextProperty.AlignmentVs.HALF
instead.@Deprecated public static final int BASE
SoTextProperty.AlignmentVs.BASE
instead.@Deprecated public static final int BOTTOM
SoTextProperty.AlignmentVs.BOTTOM
instead.@Deprecated public static final int LEFT_TO_RIGHT
SoTextProperty.Orientations.LEFT_TO_RIGHT
instead.@Deprecated public static final int RIGHT_TO_LEFT
SoTextProperty.Orientations.RIGHT_TO_LEFT
instead.@Deprecated public static final int TOP_TO_BOTTOM
SoTextProperty.Orientations.TOP_TO_BOTTOM
instead.@Deprecated public static final int BOTTOM_TO_TOP
SoTextProperty.Orientations.BOTTOM_TO_TOP
instead.@Deprecated public static final int NONE
SoTextProperty.Styles.NONE
instead.@Deprecated public static final int UNDERLINE
SoTextProperty.Styles.UNDERLINE
instead.@Deprecated public static final int STRIKETHROUGH
SoTextProperty.Styles.STRIKETHROUGH
instead.@Deprecated public static final int DOUBLE_STRIKETHROUGH
SoTextProperty.Styles.DOUBLE_STRIKETHROUGH
instead.@Deprecated public static final int BACK_FRAME
SoTextProperty.Styles.BACK_FRAME
instead.@Deprecated public static final int BACK_FRAME_LINE
SoTextProperty.Styles.BACK_FRAME_LINE
instead.@Deprecated public static final int OVERLINE
SoTextProperty.Styles.OVERLINE
instead.@Deprecated public static final int UNDERLINE_COLOR
SoTextProperty.StyleColorType.UNDERLINE_COLOR
instead.@Deprecated public static final int STRIKETHROUGH_COLOR
SoTextProperty.StyleColorType.STRIKETHROUGH_COLOR
instead.@Deprecated public static final int DOUBLE_STRIKETHROUGH_COLOR
SoTextProperty.StyleColorType.DOUBLE_STRIKETHROUGH_COLOR
instead.@Deprecated public static final int BACK_FRAME_COLOR
SoTextProperty.StyleColorType.BACK_FRAME_COLOR
instead.@Deprecated public static final int BACK_FRAME_LINE_COLOR
SoTextProperty.StyleColorType.BACK_FRAME_LINE_COLOR
instead.@Deprecated public static final int OVERLINE_COLOR
SoTextProperty.StyleColorType.OVERLINE_COLOR
instead.@Deprecated public static final int NUM_EFFECTS_COLORS
SoTextProperty.StyleColorType.NUM_EFFECTS_COLORS
instead.public final SoSFFloat aliasingFactor
The anti-aliasing applied transfer functions are:
A value of 0 essentially turns off antialiasing. Only pixels that are full opacity will be rendered. Value 1 is the native antialiasing provided by the FreeType library. Values < 1 scale down the opacity of semi-transparent pixels, so lower opacity pixels become completely transparent, effectively making the character glyphs sharper but narrower. Values > 1 scale up the opacity of semi-transparent pixels, effectively making the characters sharper but wider. Values greater than 5 have little additional visual effect.
public final SoSFEnum<SoTextProperty.AlignmentHs> alignmentH
AlignmentH
enum. Default value is LEFT. With LEFT alignment, the left edge of the first line is at the (transformed) origin, and all left edges are aligned. RIGHT alignment is similar. CENTER alignment places the center of the first string at the (transformed) origin, with the centers of all remaining strings aligned under it. Default value can be changed using the environment variable OIV_TEXT_ALIGNMENTH.
Note: This field is only effective when the justification field of a text node is set to INHERITED. When orientation is vertical, horizontal alignment is only applied on the first line.
public final SoSFEnum<SoTextProperty.AlignmentVs> alignmentV
AlignmentV
enum. Default is BASE. With TOP alignment, the top edge of the first line is at the (transformed) origin, and all top edges are aligned. BOTTOM alignment is similar. HALF alignment places the center of the first string at the (transformed) origin, with the centers of all remaining strings aligned under it. Default value can be changed using the environment variable OIV_TEXT_ALIGNMENTV. When orientation is horizontal, vertical alignment is only applied on the first line.public final SoSFFloat backFrameLineWidth
SoText2
text, and is a 1/40 of the current font size for SoText3
text. Default value is 1.0 Default value can be changed using the environment variable OIV_TEXT_BACKFRAMELINE_WIDTH.
public final SoSFBool kerning
public final SoSFEnum<SoTextProperty.Orientations> orientation
Orientation
enum. Default is LEFT_TO_RIGHT. Default value can be changed using the environment variable OIV_TEXT_ORIENTATION.public final SoSFVec2i32 textureQualityRange
SoComplexity.value
. Default is 150 to 300. Default range values can be changed using the environment variables OIV_MIN_TEXTURED_FONT_RES and OIV_MAX_TEXTURED_FONT_RES.
public final SoSFBitMask<SoTextProperty.Styles> style
Style
enum. Default is NONE.
Note: UNDERLINE, STRIKETHROUGH and DOUBLE_STRIKETHROUGH are not implemented for vertical oriented text ( ie: Orientation
set to TOP_TO_BOTTOM or BOTTOM_TO_TOP).
public final SoMFColorRGBA styleColors
StyleColor
enum (NOT the Style
enum) to assign the color to the desired style. For example, assign opaque red to the underline color. Default is (0.8,0.8,0.8,1) = the Open Inventor default diffuse color with alpha=1 (opaque).// Note the set1Value method expects an "int" as its first parameter SoTextProperty node = new SoTextProperty(); node.styleColors.set1Value( SoTextProperty.StyleColorType.UNDERLINE_COLOR.getValue(), new SbColorRGBA(1, 0, 0, 1) );
public final SoSFFloat margin
public final SoMFBool styleColorsUseCurrentMaterial
SoMaterial
instead of the value specified by styleColors
for each available style (default gray).
For example, if the entry corresponding to UNDERLINE_COLOR is set to true, underline will be rendered using the color inherited from SoMaterial
. This is convenient if (as usual) the underline should be the same color as the text. Use the index values defined in the StyleColor
enum (NOT the Style
enum) to set the value for the desired style (see example code for styleColors
field).
public final SoSFFloat characterSpacing
SoText2
) and 3D text (SoText3
). Default is 0.
public final SoSFBool enableTextAccumulation
SoText3
nodes.
Default is false. Accumulation mode significantly improves performance for scene graphs containing many SoText3
nodes. There are some drawbacks and limitations:
SoDepthOffset
is not supported.
Default value can be changed using the environment variable OIV_TEXT_ACCUMULATION.
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com