Undocumented in source.
You may wish to begin by reading the [text widget conceptual overview]TextWidget which gives an overview of all the objects and data types related to the text widget and how they work together.
Undocumented in source.