Reputation: 2273
At present, I'm using FormattedText.BuildGeometry() to get the geometry of text.
First, I draw the text geometry with a thicker pen, then on top of that I draw the text. The final effect is that the text seems to have an outline.
My problem is that the BuildGeometry() method is very time consuming. Is there any other way to draw text outlines efficiently?
Upvotes: 0
Views: 614
Reputation: 4502
A few years ago when I was working on J2ME, I use this method to make text have some outline (pseudocode, but it can be easily updated to WPF):
setColor(outlineColor)
drawText(x - 1, y, text)
drawText(x + 1, y, text)
drawText(x, y - 1, text)
drawText(x, y + 1, text)
setColor(textColor)
drawText(x, y, text)
(assuming you want to draw text at x, y coordinates).
I think drawing the text 4 times more might be faster than with BuildGeometry.
Upvotes: 1