TEXT

Renders a text.

Properties

align

align
Type
align / stdWrap
Default
left

The alignment of the text.

Possible values:

  • left
  • center
  • right

angle

angle
Type
degree
Default
0
Range
-90 to 90

The rotation degree of the text.

antiAlias

antiAlias
Type
boolean
Default
1 (true)

The FreeType antialiasing.

breakSpace

breakSpace
Type
float
Default
1.0

Defines a value that is multiplied by the line height of the current element.

breakWidth

breakWidth
Type
integer / stdWrap

Defines the maximum width for an object, overlapping elements will force an automatic line break.

doNotStripHTML

doNotStripHTML
Type
boolean
Default
0 (false)

If set, HTML tags inserted in the text are not removed. Any other HTML code will be removed by default!

emboss

emboss
Type
GIFBUILDER object ->EMBOSS

fontColor

fontColor
Type
GraphicColor / stdWrap
Default
black

The font color.

fontFile

fontFile
Type
resource / stdWrap
Default
Nimbus (Arial clone)

The font face (TrueType *.ttf and OpenType *.otf fonts can be used).

fontSize

fontSize
Type
positive integer / stdWrap
Default
12

The font size.

hide

hide
Type
boolean / stdWrap
Default
0 (false)

If this is true, the text is not printed.

This feature may be used, if you need a SHADOW object to base a shadow on the text, but do not want the text to be displayed.

iterations

iterations
Type
positive integer / stdWrap
Default
1

How many times the text should be "printed" onto it self. This will add the effect of bold text.

maxWidth

maxWidth
Type
positive integer / stdWrap

Sets the maximum width in pixels, the text must be. Reduces the fontSize, if the text does not fit within this width.

Does not support setting alternative font sizes in splitRendering options.

niceText

niceText
Type
boolean / stdWrap

This is a very popular feature that helps to render small letters much nicer than the FreeType library can normally do. But it also loads the system very much!

The principle of this function is to create a black/white image file in twice or more times the size of the actual image file and then print the text onto this in a scaled dimension. Afterwards GraphicsMagick/ImageMagick scales down the mask and masks the fontColor down on the original image file through the temporary mask.

The fact that the font is actually rendered in the double size and scaled down adds a more homogeneous shape to the letters. Some fonts are more critical than others though. If you do not need the quality, then do not use the function.

after

niceText.after

GraphicsMagick/ImageMagick parameters after scale.

before

niceText.before

GraphicsMagick/ImageMagick parameters before scale.

scaleFactor

niceText.scaleFactor
Type
integer (2-5)

The scaling factor.

sharpen

niceText.sharpen
Type
integer (0-99)

The sharpen value for the mask (after scaling). This enables you to make the text crisper, if it is too blurred!

offset

offset
Type
x,y +calc / stdWrap
Default
0,0

The offset of the text.

outline

outline
Type
GIFBUILDER object ->OUTLINE

shadow

shadow
Type
GIFBUILDER object ->SHADOW

spacing

spacing
Type
positive integer / stdWrap
Default
0

The pixel distance between letters. This may render ugly!

splitRendering

splitRendering
Type
integer / (array of keys)

Split the rendering of a string into separate processes with individual configurations. By this method a certain range of characters can be rendered with another font face or size. This is very useful if you want to use separate fonts for strings where you have latin characters combined with, for example, Japanese and there is a separate font file for each.

You can also render keywords in another font / size / color.

[array]

splitRendering.[array]
Type
integer

With keyword being [charRange, highlightWord].

  • splitRendering.[array] = keyword with keyword being [charRange, highlightWord]
  • splitRendering.[array] {

    • fontFile: Alternative font file for this rendering.
    • fontSize: Alternative font size for this rendering.
    • color: Alternative color for this rendering, works only without niceText.
    • xSpaceBefore: x space before this part.
    • xSpaceAfter: x space after this part.
    • ySpaceBefore: y space before this part.
    • ySpaceAfter: y space after this part.

    }

Keyword: charRange

splitRendering.[array].value = Comma-separated list of character ranges (for example, 100-200) given as Unicode character numbers. The list accepts optional starting and ending points, for example, - 200 or 200 - and single values, for example, 65, 66, 67.

Keyword: highlightWord

splitRendering.[array].value = Word to highlight, makes a case sensitive search for this.

Limitations:

  • The pixel compensation values are not corrected for scale factor used with niceText. Basically this means that when niceText is used, these values will have only the half effect.
  • When word spacing is used the highlightWord mode does not work.
  • The color override works only without niceText.

Example:

EXT:site_package/Configuration/TypoScript/setup.typoscript
10.splitRendering.compX = 2
10.splitRendering.compY = -2
10.splitRendering.10 = charRange
10.splitRendering.10 {
  value = 200-380 , 65, 66
  fontSize = 50
  fontFile = EXT:core/Resources/Private/Font/nimbus.ttf
  xSpaceBefore = 30
}
10.splitRendering.20 = highlightWord
10.splitRendering.20 {
  value = TheWord
  color = red
}
Copied!

compX

splitRendering.compX
Type
integer

Additional pixel space between parts, x direction.

compY

splitRendering.compY
Type
integer

Additional pixel space between parts, y direction.

text

text
Type
string / stdWrap

This is text on the image file. The item is rendered only, if this string is not empty.

The $cObj->data array is loaded with the page record, if, for example, the GIFBUILDER object is used in TypoScript.

textMaxLength

textMaxLength
Type
integer
Default
100

The maximum length of the text. This is just a natural break that prevents incidental rendering of very long texts!

wordSpacing

wordSpacing
Type
positive integer / stdWrap
Default
spacing * 2

The pixel distance between words.