How to reduce line spacing for a specific Font

Hello,

We’re using CommonUI for our in-game text, leveraging Composite Fonts to manage various font families. This setup works well for substituting fonts for different cultures (e.g., Chinese) to ensure correct display.

However, we’re encountering a significant issue with line height. Both the TextBlock widget and CommonUI’s TextStyle Blueprints have a “Line Height Percentage” property. The problem is that this property applies globally, modifying the line height for all languages, even those that don’t require adjustment.

Ideally, we need a way to either:

  • Reduce the line spacing for specific fonts or cultures (e.g., Chinese) without affecting others.
  • Get the TextBlock widget to dynamically adjust its size based on the actual rendered characters, rather than accounting for the full potential character height of the font (which often leads to excessive padding, as shown in the attached image).

We’ve explored the IsAscendOverriden and IsDescendOverriden font properties, but these tend to misalign text within the TextBlock, making UI layout much more difficult.Any insights or potential solutions would be greatly appreciated!

Thanks,

Hi,

We don’t currently support ascender/descender overrides for fonts other than the default in a composite font (which would likely be the easiest way to adjust this), but there are some snippets on [this [Content removed] that you could try integrating to add that functionality. What sort of misalignment are you seeing? You should be able to get something similar to a line height adjustment by overriding both, it can be helpful to pull up a text block widget within a canvas panel set to “Size to Content” so you can see the changes live within the bounding box while adjusting the values in the font face editor.

Best,

Cody