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"

When creating a style, are the font style and font size coupled together?

I'm trying to figure out the TTF_FONT macro when creating my style set. I have a specific color and specific font that I want to make available as a style, but there are multiple font sizes that I want to utilize.

From my style file:

 ...
 
 #define TTF_FONT(RelativePath, ...) FSlateFontInfo(FPaths::GameContentDir() / "Resources" / RelativePath + TEXT(".ttf"), __VA_ARGS__)
 
 ...
 
 Style.Set("MyFontStyle", FTextBlockStyle(FTextBlockStyle::GetDefault())
      .SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 0.74902f, 0729412f)))
      .SetFont(TTF_FONT("Verdana", 40)));

Note that very last line -- if I don't supply both the font and a size, compiling complains.

When I apply the style to my Slate widget:

 ...
 
 SNew(STextBlock)
 .TextStyle(MyStyleSet::Get(), "MyFontStyle")
 .Text(LOCTEXT("Hello World")
 
 ...

I thought perhaps I could use this style with a set font, and then when I apply the style to a STextBlock widget, I could then override the style's font with a .FontSize or something, but nothing like that seems to exist. Does this mean the font and size are coupled together? Do I really need to make a separate style for every size of this text block style that I want to utilize?

Thanks in advance for any insight!

Product Version: UE 4.19
Tags:
more ▼

asked May 17 '18 at 09:43 PM in C++ Programming

avatar image

eddiek99
1

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

0 answers: sort voted first
Be the first one to answer this question
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