PopcornFX v2.18

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.18
  4. Scripting reference
  5. Samplers
  6. Text sampler

Text sampler

Text sampler

Sampling functions

Return typeDescription
intSamplerName.charCode(int charId)
Samples a character at global position charId in the text data, and returns the ASCII code of the sampled character.
intSamplerName.charCode(int2 lineAndCharId)
Samples a character at line lineAndCharId.x and position lineAndCharId.y within that line, and returns the ASCII code of the sampled character.
int2SamplerName.charLineId(int charId)
Returns an int2 vector containing the 0-based line index of the specified character in x and the 0-based character index relative to the start of the line in y.charId is the global character index in the [0, totalCharCount] range.
floatSamplerName.charOffset(int charId)
Returns the horizontal distance between charId and the beginning of the line in displayable units, where 1.0 is the average glyph size.Takes kerning into account if a kerning file has been provided in the text sampler and its UseKerning property is enabled.
Only works for characters whose charCode is in the [0,255] range.
If you need to work with some unicode characters, you will need to reencode the text string to map them in free slots of the [0,255] range, and remap their entries in the kerning file.
floatSamplerName.lineOffset(int lineId)
Returns the vertical distance between charId and the beginning of the text in displayable units, where 1.0 is the average glyph size.
Defaults to 3.0 if no metrics file has been provided in the text sampler.

 

Properties

Return typeDescription
intSamplerName.charCount()
Returns the number of characters in the entire text.
intSamplerName.charCount(int charId)
Returns the number of characters of the specified line of the text.
intSamplerName.lineCount()
Returns the number of lines in the entire text.

 

Note: These are describing the reference implementation. When using attribute samplers, the behavior of these functions can vary depending on the implementation in the game-engine where the effect is loaded.

Was this article helpful to you? Yes No

How can we help?