Show/Hide Toolbars

RiverSoftAVG Products Help

Represents the common ancestor for all text elements (text, tref, tspan, text-path). Every svg text element potentially has multiple X, Y, DX, DY, and Rotate values to specify the location and orientation of each character in the text. If a text element does not specify its own X and Y values itself, it uses the RSSVG.Text.TSVGCustomText.CurrentTextPosition.

alert_noteNotes to Implementers

Using default options on desktop platforms, all text elements in the RSCL work by converting the text into paths. First, the text of the parent and all of its text content children are divided into chunks. Each absolute position adjustment defines a new text chunk. A text chunk can span text child elements if they do not define a new absolute position. After the text is divided into chunks, the CreateTextShapes method (implemented in the TSVGText class) creates paths from all the text chunks.

Note that the TSVGTextPath class subverts this text chunking to provide an absolute position for every character so that the text aligns along its path.

When TSVGDocument.Options includes the soUseFillText option, text is not converted into paths but rendered directly to the canvas using FillText calls. On iOS and Android and when using the FMX GPU Canvas on desktop (FMX.Types.GlobalUseGPUCanvas), text is always filled.
 

The following differences exist between the two text rendering paths:

Fill Text does not use the Pen and so cannot both fill and stroke text

Fill Text cannot use gradients for filling (FMX)

Fill Text uses less memory

Fill Text generates better text at small sizes

Fill Text does not do center and right alignment for complex text (i.e., text that has dx, dy, rotate, vertical writing mode, etc style properties defined)

Fill Text has better compatibility with non-Western fonts

Path-based text can both fill and stroke text (however, on non-Windows platforms gradients are not used in stroking text)

Path-based text caches its shapes so subsequent draw calls are faster, even faster than fill text calls in many cases

Path-based text allows pixel level selection of text; Fill Text can only be selected as a text bounding box

Path-based text renders decorative fonts (underline, overline, and strike-out) using an extra path for the decoration (FMX will not generate paths with the decoration when converting text to paths). Surprisingly, this means that compatibility is higher with path-based text as the decoration gets its rendering configuration from the parent text element (e.g., strike-out text should use the parent text's font size and not vary as the size of child text span's font size changes).

ShapeRendering affects the smoothness of text when filling path-based text (as text are shapes); TextRendering affects the smoothness of text when filling text

Namespace: RSSVG.Text

Top

Top

RiverSoftAVG Products Help © 1996-2016 Thomas G. Grubb