Rich Text Image Decorators: how to make them scale by height and not by width?

I’m trying to use image decorators as icons for keys and buttons in tutorial messages.
It’s working ok, but some icons have elongated shapes (like the space bar icon or gamepad R and L buttons), they are wide and short. In this cases, the rich text seems to scale the decorators so they fit in a fixed width, so when the icon is short and wide it’s scaled down and appears too small compared to icons that have a regular shape (like a gamepad button that is a perfect circle).
So I was hoping there was a way to make the rich text fit the images scaling them to fit the height instead of the width (of course that would cause the inverse problem: tall and thin icons would appar small - but in my case I don’t have any tall and thin icons so that wouldn’t be a problem for me). Is there any way to do that?

For anyone stumbling upon this you can find inline decorator options in RichTextBlockImageDecorator.cpp (see: CreateDecoratorWidget function).
As of writing this you can utilize:

  • width=“somenumber”
  • width=“desired” (this will use the image width set in the data table)
  • height=“somenumber”
  • height=“desired” (this will use the image height set in the data table)
  • stretch=“stretchOption” (stretch options use EStretch enum values (see SScaleBox.h))

Example of text set on the RichTextBlock (either via Details Panel or SetText function):
My text content <img id="FooRowName" height="64" width="64" stretch="ScaleToFit"/> more text content

Use any combination to fit your needs :slightly_smiling_face:

As for the OP, I believe they would want to utilize the stretch=“ScaleToFitY” option.

1 Like