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"

[Closed] Slate fonts

Hi,

Okay, so I know that Slate fonts can't be set from the editor, so I took a look at the ShooterGame sample. Here is my take at fonts :

 #define TTF_FONT( RelativePath, ... ) FSlateFontInfo( FPaths::GameContentDir() / "GUI" / RelativePath + TEXT(".ttf"), __VA_ARGS__ ) // Straight from SGame 

 SAssignNew(TitleText, STextBlock)
     .Text(InArgs._Title)
     .TextStyle(TStyle)
     .Font(TTF_FONT("Font", 14))

And well, I am getting insulted at runtime :

LogSlate:Warning: GetFontFace failed to load or process '../../../../Project/Content/GUI/Font.ttf'

I don't know about the multiple ../, they seem wrong, but the font is really in D:/Project/Content/GUI/Font.ttf . Unreal is in D:/Unreal.

Is this a path error, or did I miss something about fonts ?

(When can we hope for a proper Font binding using the editor ?)

Product Version: Not Selected
Tags:
more ▼

asked Apr 12 '14 at 01:19 PM in C++ Programming

avatar image

StrangerGwenn
594 55 64 133

avatar image Jamie Dale STAFF Apr 12 '14 at 02:09 PM

That looks correct to me, assuming: D:\Unreal\Engine\Binaries\Win64\UE4Editor.exe D:\Project\Content\GUI\Font.ttf

The relative path would be: ../../../../Project/Content/GUI/Font.ttf

How are you running the game? The path you've chosen (GUI) won't get packaged, so if you're running a cooked and packaged game, then the font might be missing (but I assume it would be using a different path then). Really fonts should go inside /Content/Slate since that directory is packaged correctly.

avatar image StrangerGwenn Apr 12 '14 at 02:36 PM

The game is running from PIE. I moved everything from Content/GUI to Content/Slate so that fonts get packaged later.

Unfortunately nothing changes. Just to be sure, I really have to put the TTF file there, not a UFont asset ?

avatar image Jamie Dale STAFF Apr 12 '14 at 02:12 PM

I've just noticed you're putting that font straight into a widget? That TTF_FONT should be into the style set for your game.

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

The question has been closed Apr 28 '15 at 07:43 AM by StrangerGwenn for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

Oh my, sorry, I just found out the name of the font was wrong. Sorry about that, there was no issue at all... It works now.

more ▼

answered Apr 12 '14 at 02:40 PM

avatar image

StrangerGwenn
594 55 64 133

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

Follow this question

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

Answers to this question