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"

Text Size in pixels showed on static text UMG widget (not HUD!).

I'm trying to get text size in specific font and font size draw onto "A simple static text widget" inside UMG which is not inside HUD, but used as actor component's widget class.

So "Get text size" (HUD) - need hud, which I don't have. "Wrapped Text Size" and "Clipped Text Size" - need canvas, which I don't have. "Get Text Local Size", "Get Text World Size" - need "text render component" which I don't use.

Google unfortunatelly show very few answers (unreal text size) :-(

So how to check what is the size of the rendered wrapped text thru Text UMG component in specific font and font size ? Maybe C++ solution?

Product Version: UE 4.9
Tags:
more ▼

asked Nov 20 '15 at 12:23 PM in Blueprint Scripting

avatar image

wab8
6 1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I dont know how to measure text in UMG but from code you can get text size using font measure service, like this:

 TSharedRef< FSlateFontMeasure > FontMeasure = FSlateApplication::Get().GetRenderer()->GetFontMeasureService();
         FSlateFontInfo Font = GET_YOUR_FONT_SOMEHOW;
         const FVector2D TextSize = FontMeasure->Measure(String_To_Measure, Font);


the only problem here will be how do you get the actual font so you can put in GET_YOUR_FONT_SOMEHOW place. The obvious solution would be to use STextBlock::GetFont method but for some reason its private....

more ▼

answered Nov 25 '15 at 09:53 AM

avatar image

szyszek
615 16 12 36

avatar image ellocator Jun 26 '18 at 11:52 AM

myTextBlock->Font (it's public)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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