x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UMG TextBlock: Font won't scale.

Hi everyone, I've set a TextBlock widget so it automatically scales according to the size of the viewport:

alt text

...as you can see, the boundaries of the widget appear to scale correctly, but the drawing scale of the font inside the TextBox does not :

alt text

I have noticed already that when using DrawText on Canvas, Runtime fonts wouldn't scale, so in that case, I switched back to Offline fonts.

Unfortunately, UMG Textboxes only use Runtime fonts...

Am I missing something, here ?

Does anybody knows a workaround?

Is this issue fixed in 4.7 ? (I'm still using 4.6.1, here)

Thanks in advance, Have a nice day.

Product Version: Not Selected
Tags:
umgissue0.jpg (158.1 kB)
umgissue1.jpg (280.5 kB)
more ▼

asked Feb 11 '15 at 06:42 PM in Everything Else

avatar image

elliotek
61 2 4 10

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey,

How are you scaling your widget? Text in Slate will be scaled based on the widget scale when drawing, however if you're just constricting the widget size, the text will start to clip (like what you're seeing there).

With regards to Canvas - the Canvas scaling issue is fixed in 4.7 (scaling for runtime fonts just wasn't implemented for 4.6), however Canvas just scales the rendered glyph texture rather than re-drawing the glyph at the newly scaled size (which is what Slate does). We did this as it matched the older offline (bitmap) font way of scaling fonts in Canvas, and avoids potentially spamming the font cache when drawing animating text (for which texture scaling is acceptable).

Thanks, Jamie.

more ▼

answered Feb 11 '15 at 06:55 PM

avatar image

Jamie Dale STAFF
7.4k 176 66 304

avatar image elliotek Feb 11 '15 at 07:38 PM

Wow Jamie, thanks for the hyper quick answer. Glad to read that 4.7 fixes the Canvas DrawText scale issue.

About my UMG issue, I relied on the anchor to scale the widget, hoping that the content of the box would scale accordingly, which seems to be a very dumb thing to do. I just figured out that the problem came from the project's DPI scale curve. I set it to "Horizontal" and made it linear. Now, it natively achieves the rescaling effect I expected without any additional awkward anchor tweaking.

Sorry for the noob question and thanks again for the answer.

avatar image elliotek Feb 25 '15 at 05:18 PM

Hey Jamie, I just stepped to 4.7 today. I checked the FCanvasTextItem::DrawStringInternal_RuntimeCache() but I can't see any code for scaling displayed text (Scale does about nothing in that function). It is well implemented in FCanvasTextItem::DrawStringInternal_OfflineCache() though, for instance, you have :

 float SizeX            = Char.USize * Scale.X;
 const float SizeY    = Char.VSize * Scale.Y;
 

Am I missing something here ?

avatar image Jamie Dale STAFF Feb 25 '15 at 05:30 PM

I've just checked my version of 4.7 and I'm seeing Scale used in FCanvasTextItem::DrawStringInternal_RuntimeCache:

 const float X = DrawPos.X + LineX + (Entry.HorizontalOffset * Scale.X);
 const float Y = DrawPos.Y + PosY - (Entry.VerticalOffset * Scale.Y) + (Entry.GlobalDescender * Scale.Y) + ScaledMaxHeight;
 // ...
 const float SizeX = Entry.USize * Scale.X;
 const float SizeY = Entry.VSize * Scale.Y;
 // ...
avatar image elliotek Feb 25 '15 at 06:39 PM

Ok, I see it when I get the 4.7 code from GitHub but it's not in the release branch. Also, when you simply install the 4.7 version from the launcher, you don't see it. Is that normal ?

avatar image Jamie Dale STAFF Feb 26 '15 at 09:40 PM

I've just checked the file history, and it seems that this was only merged into 4.7 two days ago.

That explains why we can see it in the GitHub checkout, but not the 4.7 binary release. It will be part of the 4.7.1 release.

avatar image elliotek Feb 27 '15 at 09:50 AM

I see. Thanks for the answer.

I've tried it and it works fine, except that the mesh generated in the BatchElements are not displayed with linear smoothing. Those with offline fonts are.
So the display gets jaggy as you scale down the text.
I posted a question on that matter : link here Thanks already.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question