I want to write a TTS program that automatically scrolls to the spoken word.
I found a solution for paragraphs. I am not using paragraphs, but I adapt this solution to use the characterIndex
of the current word:
TextPointer startTextRange = richtTextselectionView.Document.ContentStart.GetPositionAtOffset(characterIndex);
verticalOffset = startTextRange.GetCharacterRect(LogicalDirection.Forward).Y;
richtTextselectionView.ScrollToVerticalOffset(verticalOffset);
This is the Result:
The Problem is that the text box is scrolling too slow.
I already tried to multiply the verticalOffset
with a constant but the behavior seems to be nonlinear...
I am using .Net6.0 and MaterialDesignThemes in the latest version.