True を返します。見えている hyphen 記号を残さずに行折り返しをまたいで単語を復元するときに便利ですproperty CharacterIsHyphen[Index: Integer]: Boolean; // read only
| Index | 現在ページの 0 基準文字インデックス。範囲は 0 から CharacterCount - 1. |
CharacterIsHyphen は、PDFium が Index の character を compound word の一部である通常の hyphen ではなく、soft (line-break) hyphen と判定したとき True を返します。判定は heuristic で、character の Unicode code point, 行末位置, 直後の text run の近さを見て、行をつなぐときに hyphen を残すべきかを決めます
Soft hyphen は LaTeX, Word, InDesign などの typesetting engine が長い単語を行で分割するために挿入します。PDF viewer から text をコピーすると、soft hyphen は通常落とされるので、"high-
way" は highway として貼り付けられ、high-way にはなりません。この property を使うと、独自の extraction code でも同じ振る舞いを再現できます
この property は Unicode soft hyphen (U+00AD) と、たまたま行末にある通常の hyphen-minus (U+002D) を区別しません。どちらも True を返します。U+00AD の case だけが必要なら、Character[Index] を直接比較してください
False になり、同じ hyphen でも行末なら True になります
// 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;