UCanvas::StrLen does not take kerning into account and returns a wrong size
I wanted to create a small Slate Widget that displays two pieces of text in diffrent font sizes directly next to each other. After rendering the first piece, and advancing my rendering position by the value UCanvas::StrLen( ... ) for it, I drew the second piece. The result was the following:
As you can see, the second piece is displaced. After tracing the problem through the sourcecode, I discovered that UCanvas::MeasureStringInternal used the Kerningvalues returned by UFont::GetCharKerning(...), and that these seem be 0 for all characters, which seems to be connected to the newer SlateFonts, whose Kerning values are stored in the FSlateFontCache. My solution to this problem was to write a new measuring method. Please keep in mind that this most likely does not cover all diffrent types of text formatting that can occur:
These one uses the values provided by the SlateFontInfo and yields correct result:
Can anyone else confirm this problem ?
asked Jan 23 '15 at 08:03 PM in Bug Reports
Ah, despite the fact that Canvas accepts Slate font data, you're not actually using Slate here :)
A better way to measure the text if you know you're dealing with a composite font (which you are) is to just use the Slate font measurer directly.
Alternatively, once you've called
Could you post the code used when setting up the
Follow this question
Once you sign in you will be able to subscribe for any updates here