PDFium Delphi Component Docs

WordBoxIndexAtCharIndex функция

Модуль: PDFium
Сопоставляет индекс символа FTextPage с TPdfWordBox, который его содержит

Синтаксис

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

Параметры

WordsTPdfWordBoxes
CharIndexInteger

Возвращаемое значение

Integer

Описание

WordBoxIndexAtCharIndex возвращает индекс word box с нуля, чьи StartIndex и Count накрывают запрошенный индекс символа, или -1, если слово не найдено

По результату выбирайте, какой TPdfWordBox подсветить или выделить, когда движется курсор TTS

Примечания

Пример

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

См. также

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