find position of word inside string

I have a Text object UMG widget that holds a string of words and displays this string on the HUD. The text in this string changes over time and can be changed by other blueprints. The fill of the text can be filled like a progess bar. This is done by applying the material shown in the image below. The fill parameter goes from 0 to 1 and determines how much of the string is coloured.

The material applied to text object widget can for example be as follows:

234688-string.png

I would like to be able to fill the words inside the string one at a time.

It seems to me that this could be done by finding the position (and length) of a word and determining the corresponding value for the fill parameter. For this would like to know if there is any way to find the position of a word inside the string on screen.

If there is a different (easier) method to achieve my results, that is also more then welcome.

Thanks in advance

If there does not exist a function like measureText in other frameworks (and I don’t think there does) then the ideas that come to mind are:

  1. Create a separate text object and fill it with each word, and then ask for the width of it? (I’m super new to UMG, so perhaps there is no way to measure the implicit size of text.)
  2. Create a map of characters to widths, and loop through the characters to sum up the word width. (Will fail if UMG supports kerning for character pairs.)
  3. Use a monospace font, so that each letter is guaranteed the same width, and then you can just multiply the number of characters by that letter width to find word length.