NCL Home > Documentation > Graphics > Resources

TextItem (tx) Resources

txAngleF
Sets the rotation angle of the text around the justification point. The angle is counterclockwise and 0 degrees is horizontal on the screen.

Default: 0.0

txBackgroundFillColor
When txPerimOn is True, txBackgroundFillColor sets the background color used as solid fill of the box defined by the TextItem perimeter. To leave the box unfilled, set txBackgroundFillColor to Transparent (-1).

Default: Transparent

txConstantSpacingF
If this resource has the value 0.0, TextItem draws characters with proportional spacing; in other words, each character is spaced according to its width relative to other characters in the font. If txConstantSpacingF has a value greater than 0.0, the distance from the beginning of one character to the beginning of the next character will be constant. The value of txConstantSpacingF sets this constant distance as a multiple of the width of a reference character box within which all characters of the font will fit. If txConstantSpacingF has the value 1.0, the constant distance will cause there to be almost no space between two wide characters such as 'M' placed next to each other. As txConstantSpacingF decreases from 1.0, characters will begin to overlap. As it increases from 1.0, characters become further separated from each other. Values less than 0.0 result in an error and are replaced with the default value.

Default: 0.0

txDirection
This resource of type NhlTTextDirection specifies the direction of the text drawn by the TextItem. There are two choices:
Down
Each character is placed below the previous character in the text string.
Across
Each character is placed to the right of the previous character in the text string.
These descriptions apply before any rotation due to txAngleF is applied to the TextItem.

Default: Across

txFont
When the txFontQuality resource has the value High, this resource of type NhlTFont specifies the font used for the TextItem. The fonts may be categorized into two types according to the way their characters are rendered: they are either stroked using lines or filled as areas. Only the stroked fonts are affected by the resource, txFontThicknessF, which sets the thickness of the stroking line. When txFontQuality is set to Medium or Low, the txFont resource is ignored.

The default font, the pwritx_database font (font index 0), differs from all other fonts in that it intrinsically contains many more characters than the other fonts (564 as opposed to somewhere between 97 and 128). A number of the Text Function Codes allow special access to the characters of the pwritx_database font.

You may use either the integer index or the string font name to specify a value for txFont. Note that whenever you change a font, the low-level NCAR Graphics library must read in the new font data from a file. The following table lists each fonts by index and name, and also indicates the rendering method used for the font:

+-------------------------------------------------------+
|		HLU Fonts				|
|-------------------------------------------------------|
| INDEX	| TYPE		| NAME				|
|=======================================================|
|  0	| stroked	| pwritx_database		|
|-------------------------------------------------------|
|  1	| stroked	| default			|
|-------------------------------------------------------|
|  2	| stroked	| cartographic_roman		|
|-------------------------------------------------------|
|  3	| stroked	| cartographic_greek		|
|-------------------------------------------------------|
|  4	| stroked	| simplex_roman			|
|-------------------------------------------------------|
|  5	| stroked	| simplex_greek			|
|-------------------------------------------------------|
|  6	| stroked	| simplex_script 		|
|-------------------------------------------------------|
|  7	| stroked	| complex_roman			|
|-------------------------------------------------------|
|  8	| stroked	| complex_greek			|
|-------------------------------------------------------|
|  9	| stroked	| complex_script		|
|-------------------------------------------------------|
| 10	| stroked	| complex_italic		|
|-------------------------------------------------------|
| 11 	| stroked	| complex_cyrillic		|
|-------------------------------------------------------|
| 12 	| stroked	| duplex_roman			|
|-------------------------------------------------------|
| 13 	| stroked	| triplex_roman			|
|-------------------------------------------------------|
| 14 	| stroked	| triplex_italic		|
|-------------------------------------------------------|
| 15 	| stroked	| gothic_german			|
|-------------------------------------------------------|
| 16 	| stroked	| gothic_english		|
|-------------------------------------------------------|
| 17 	| stroked	| gothic_italian		|
|-------------------------------------------------------|
| 18 	| stroked	| math_symbols			|
|-------------------------------------------------------|
| 19 	| stroked	| symbol_set1			|
|-------------------------------------------------------|
| 20 	| stroked	| symbol_set2			|
|-------------------------------------------------------|
| 21	| filled	| helvetica			|
|-------------------------------------------------------|
| 22	| filled	| helvetica-bold		|
|-------------------------------------------------------|
| 25	| filled	| times-roman			|
|-------------------------------------------------------|
| 26	| filled	| times-bold			|
|-------------------------------------------------------|
| 29	| filled	| courier			|
|-------------------------------------------------------|
| 30	| filled	| courier-bold			|
|-------------------------------------------------------|
| 33	| filled	| greek				|
|-------------------------------------------------------|
| 34	| filled	| math-symbols			|
|-------------------------------------------------------|
| 35	| filled	| text-symbols			|
|-------------------------------------------------------|
| 36	| filled	| weather1			|
|-------------------------------------------------------|
| 37	| filled	| weather2			|
+-------------------------------------------------------+

Default: 0

txFontAspectF
This resource sets the aspect ratio, defined as the height divided by the width of a reference character box within which all characters of the font will fit. Its value determines the width of the characters relative to txFontHeightF. If given the value 1.0, wide characters such as 'M' will be approximately square in shape. Values increasing from 1.0 result in thinner characters, while values decreasing from 1.0 result in wider characters.

Default: 1.3125

txFontColor
Integer value that is an index into parent workstations color map.

Default: 1

txFontHeightF
Height of text from bottom of average character to top of average character in NDC coordinates.

Default: .05

txFontOpacityF
Available in version 6.1.0 and later.

Sets the opacity of text drawn as graphics on a plot. Specify a floating-point value in the range of 0.0 (completely transparent) to 1.0 (fully opaque).

Default: 1.0

txFontQuality
This resource of type NhlTFontQuality determines the quality of the font used to draw the TextItem. There are three choices:
High
Draw characters using any of the stoked or filled fonts.
Medium
Draw characters using a 94 character stroked font that is simpler than the High quality fonts, resulting in somewhat smaller metafiles. The txFont resource is ignored.
Low
The characters are output as a string into the metafile. The quality of the output therefore depends on the fonts available to the metafile translator. When NCAR translators are used the font quality is similar to that of Medium text. The txFont resource is ignored.

Default: High

txFontThicknessF
Sets the thickness of the lines used to draw the characters of the TextItem. The value acts as a multiplier of a (device-dependent) unit thickness. This resource is ignored when the txFont specifies a filled font (font indexes 21-22, 25-26, 29-30, and 33-37).

Default: 1.0

txFuncCode
Specifies the character used to delimit Text Function Codes embedded in the TextItem string.

Note: the default function code was a colon (:) in NCL Versions 6.0.0 and earlier.

Default: ~

txJust
This resource of type NhlTJustification sets the justification point of the TextItem. The first part of the string should be set to the desired vertical justifcation ("top", "center", "bottom"), and the second part to the desired horizontal justification ("left", "center", "right").

Default: CenterCenter

txPerimColor
When txPerimOn is True, txPerimColor specifies the HLU color index used for the line around the perimeter of the text.

Default: Foreground

txPerimDashLengthF
When txPerimOn is True, txPerimDashLengthF specifies the length of each segment of the dash pattern used to draw the perimeter line around the TextItem.

Default: 0.15

txPerimDashPattern
When txPerimOn is True, txPerimDashPattern specifies the HLU index of the dash pattern used to draw the perimeter line around the TextItem.

Default: 0

txPerimOn
This boolean resource that determines whether the TextItem draws a box around the perimeter of the text. The box may or may not have a solid fill background.

Default: False

txPerimSpaceF
When txPerimOn is True, txPerimSpaceF determines the spacing or margin between the text of the TextItem and perimeter outline as a fraction of the current txFontHeightF.

Default: 0.5

txPerimThicknessF
When txPerimOn is True, txPerimThicknessF specifies the thickness of the perimeter line around the TextItem. The value acts as a multiplier of a (device-dependent) unit thickness.

Default: 1.0

txPosXF
Is the X location of the justification point in NDC coordinates.

Default: <dynamic>
If the View resources are used to position the TextItem then this resource will be determined from that placement, otherwise its default is 0.0.

txPosYF
Is the Y location of the justification point in NDC coordinates.

Default: <dynamic>
If the View resources are used to position the TextItem then this resource will be determined from that placement, otherwise its default is 1.0.

txString
Specifies the string that the TextItem is to draw. The string may contain Text Function Codes that allow you to control typographical attributes such as subscripting and superscripting, change fonts within a string, embed newlines, etc.

Default: <dynamic>
If this resource is not set, then the default value for this resource will be the name of the TextItem object.