PDFium Component Docs

CharacterIsHyphen Egenskap

Denna API-post behåller identifierare, signaturer, kodblock och PDF-termer i ursprunglig form.
Komponent: TPdf  ·  Enhet: PDFium
Returns True when the character at the specified index is recognised as a soft hyphen used for end-of-line word breaking. Useful when reconstructing words across line wraps without retaining the visible hyphen mark.

Syntax

property CharacterIsHyphen[Index: Integer]: Boolean; // read only

IndexNollbaserat teckenindex på aktuell sida, i intervallet 0 till CharacterCount - 1.

Beskrivning

CharacterIsHyphen returns True when PDFium classifies the character at Index as a soft (line-break) hyphen rather than a regular hyphen that belongs to a compound word. The classification is heuristic: it looks at the character's Unicode code point, the line-end position, and the proximity of the following text run to decide whether the hyphen should be kept when joining lines.

Mjukbindestreck infogas av sättningsmotorer (LaTeX, Word, InDesign) för att dela långa ord över rader. När du kopierar text från en PDF-visare tas mjukbindestrecket vanligtvis bort så att "high-
way" pasted as highway rather than as high-way. This property lets your own extraction code reproduce that behaviour.

The property does not distinguish the Unicode soft hyphen (U+00AD) from a regular hyphen-minus (U+002D) that happens to sit at a line end — both will report True i sådana situationer. Om du bara vill ha U+00AD case, compare Character[Index] directly.

Anmärkningar

Exempel

// Reconstruct words across line wraps, dropping soft hyphens
var
  I: Integer;
  S: WString;
begin
  S := '';
  for I := 0 to Pdf.CharacterCount - 1 do
    if not Pdf.CharacterIsHyphen[I] then
      S := S + Pdf.Character[I];
  Memo1.Text := S;
end;

Se även

Character, CharacterGenerated, CharacterCount, Text