procedure SetTextPositions(ObjectIndex: Integer; const Positions: TPdfSingleArray);
| ObjectIndex | Integer. Zero-based index of the text object whose character positions are to be set (0 to ObjectCount - 1) |
| Positions | TPdfSingleArray. Array of per-character offsets in points, relative to the text object origin. Positions[0] sets the position of the second character, Positions[1] the third, and so on. The first character is always at position 0 |
SetTextPositions overrides the default character spacing of a text object by supplying an explicit horizontal offset for each character. This enables fine-grained kerning control, justified text layout, or reproduction of the exact character placement found in an existing PDF
The Positions array contains one entry per inter-character gap, starting from the gap between the first and second characters. Specifically, Positions[0] is the position of the second character, Positions[1] is the position of the third character, and so on — all measured in points from the text object's origin along the text baseline. The first character is always placed at offset 0. The array length must be exactly one less than the native text-item count; mismatched lengths are rejected by the native setter. The public method requires a nonempty array, so a one-item object has no positions to set
This method is typically used together with SetText when reconstructing or editing text objects whose original character spacing must be preserved exactly
// Add text, then apply custom per-character positions
Pdf1.AddPage(1, 595, 842);
Pdf1.AddText('HELLO', 'Arial', 24, 72, 700);
var
Idx: Integer;
Pos: TPdfSingleArray;
begin
Idx := Pdf1.ObjectCount - 1;
// 'H' at 0 (implicit), 'E' at 20, 'L' at 38, 'L' at 56, 'O' at 74
SetLength(Pos, 4);
Pos[0] := 20; Pos[1] := 38; Pos[2] := 56; Pos[3] := 74;
Pdf1.SetTextPositions(Idx, Pos);
end;
Since internal v3.403.0, direct logical text, object membership and ActualText changes clear affected saved paragraph cluster tables Geometry, style and metadata-only changes retain tables and regenerate complete represented shared mark scopes across adjacent nonempty streams Mark list membership is local to the selected object, while exact shared declarations keep their identity The bundled DLLs isolate named-property parameter edits; native builds without detachment reject a table-affecting logical change before mutation
Read native character maps again after mutation or reload These low-level operations do not supply reviewed replacement semantics or repair arbitrary tagged ownership Use the batch semantic-edit policies when those values and bindings must be reviewed together See scope, ownership and remaining source-preservation limits