Decrease line spacing in a TextBlock / FlowDocument

Joe White picture Joe White · Aug 10, 2009 · Viewed 19.7k times · Source

Some fonts have a large amount of whitespace above and below the characters. Is there a way to correct for that, and tighten up the space between lines of a word-wrapped paragraph in WPF (in either a TextBlock or a FlowDocument)? Kind of like a negative margin between lines?

There's a LineHeight property on Paragraph and TextBlock, but it only seems to let you increase the spacing -- if you set it to a smaller value than the default, it's simply ignored.

Answer

Joel picture Joel · Sep 17, 2009

Set the LineHeight like before, but change the LineStackingStrategy to BlockLineHeight