PDFium Delphi Component Docs

AddShapedText metode

Komponent: TPdf  ·  Enheder: PDFium, FPdfTextShaping

Syntax

function AddShapedText(const Text, Font: WString; FontSize: Single; X, Y: Double; out Shaped: TPdfShapedText; Direction: TPdfTextDirection = ptdAuto; Color: TColor = clBlack; Alpha: Byte = $FF): Boolean;

Description

Former Unicode-tekst gennem den native Windows-script-motor, indlæser den valgte systemskrifttype én gang og skriver eksplicit positionerede glyffer gennem PDFiums CID Type 2-skrifttype-API

ptdAuto opløser afsnittets grundretning fra det første stærke tegn, mens eksplicitte left-to-right- og right-to-left-tilstande er tilgængelige til applikationsstyret layout

Unicode semantics

Each glyph receives a bounded CID mapping and a generated ToUnicode entry, including cluster-aware mappings for ligatures and contextual forms

The text object carries the original logical string in ActualText, so conforming consumers can recover logical reading order even when positioned glyph geometry is visual-order bidi content

TPdf.Text follows PDFium's physical bidi extraction order and may therefore differ from the original logical input order

Shaping result

TPdfShapedText returns font bytes, total width, glyph and logical-character counts, and visual runs containing bidi levels, glyph IDs, advances, offsets, and source clusters

Use ShapePdfText for shaping without modifying a document, or instantiate TPdfUniscribeTextShaper with TPdfTextShapingOptions when explicit character, glyph, and run budgets are required

Safety and performance

Input, glyph, and run limits fail closed before unbounded allocation

Runs sharing one baseline are emitted as one text object and glyph positions are generated in linear time

The method requires the PDFium CID Type 2 font, character-code, position, marked-content, and content-regeneration exports

See Also

AddText, GetStructuredText, GenerateLayout