Background colour for AttributedString


Hi everybody,

I am currently building a Markdown Parser for embedding the documentation into my project and I came pretty far by abusing the Attributed String for the text paragraph rendering:

The only thing I didn’t find out is how to set the background colour for a particular token (which is useful to highlight inline blocks of monospaced code like GitHub or this fabulous place are doing).

If there was a function in AttributedString (or TextLayout) like

Rectangle<int> AttributedString::getAreaForText(Range<int> rangeInText) const

that returns the bounds of the given substring (or the first occurrence of it) within an Attributed String, it would be a tremendous help. This can be of course only called after creating the layout when the positioning is done, but I could work around this by drawing the rectangle manually before the text is rendered.