PDFium Delphi Component Docs

WordBoxIndexAtCharIndex 関数

ユニット: PDFium
FTextPage 文字インデックスを、それを含む TPdfWordBox に対応付けます

構文

function WordBoxIndexAtCharIndex(const Words: TPdfWordBoxes; CharIndex: Integer): Integer;

パラメーター

WordsTPdfWordBoxes
CharIndexInteger

戻り値

Integer

説明

WordBoxIndexAtCharIndex は、StartIndex と Count が要求された文字インデックスを含む word box の 0 基準インデックスを返します。一致する単語がなければ -1 です

この結果を使えば、TTS カーソルの進行に合わせてどの TPdfWordBox をハイライトや選択の対象にするか決められます

備考

例

Index := WordBoxIndexAtCharIndex(Words, PdfView1.CurrentCharIndex);
if Index >= 0 then
  PdfView1.SelectWordBox(Words[Index]);

関連項目

BuildWordBoxes, TPdfView.PageWordBoxes, TPdfView.SelectWordBox, TPdfView.SetReadingHighlight