function WordBoxIndexAtCharIndex(const Words: TPdfWordBoxes; CharIndex: Integer): Integer;
| Words | TPdfWordBoxes |
| CharIndex | Integer |
IntegerWordBoxIndexAtCharIndex は、StartIndex と Count が要求された文字インデックスを含む word box の 0 基準インデックスを返します。一致する単語がなければ -1 です
この結果を使えば、TTS カーソルの進行に合わせてどの TPdfWordBox をハイライトや選択の対象にするか決められます
CharIndex がどの単語範囲にも入らない場合は -1 を返しますIndex := WordBoxIndexAtCharIndex(Words, PdfView1.CurrentCharIndex);
if Index >= 0 then
PdfView1.SelectWordBox(Words[Index]);