public HighlightColor GetColorForPosition(int x)
{
if (Words != null) {
int xPos = 0;
foreach (TextWord word in Words) {
if (x < xPos + word.Length) {
return word.SyntaxColor;
}
xPos += word.Length;
}
}
return new HighlightColor(Color.Black, false, false);
}