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"

Slate: Styles and fonts

Hey everyone.

I'm having a weird problem with Slate and styles.

I have my Slate UI up and running and I've set up styles that the UI loads and adopts. Everything works perfectly, except for one single thing: fonts!

When editing the Style in the editor, I've set the option of being able to change the font style of a widget. When I step through the code in the debugger I can see that it has the correct info in the style, but Slate can't seem to find the font I requested in the style settings.

I've tried with the font name alone (excelate.ttf), with a relative path from Content (UI/Fonts/excelate.ttf) and neither works.

I've tried to hardcode the font with a full path in the code, and it loads perfectly - but I'd really like to be able to give the designers ability to edit the font style from the editor through Styles.

Is there something I'm missing? An ini-file setting that sets up the root directory for Slate to look for assets in, or something like that?

Where does Slate look for fonts by default? I've tried copying the font file to Engine/Content/Slate/Fonts and still no go there either.

Hope one of you guys can help!

Thanks in advance!

Product Version: Not Selected
Tags:
more ▼

asked Apr 01 '14 at 09:53 PM in C++ Programming

avatar image

ReqPro
59 9 12 15

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

1 answer: sort voted first

If by "in the editor" you mean via a Slate Widget Style asset, then unfortunately fonts cannot currently be set that way as we don't yet have a font asset that will work with Slate.

Fonts must currently be set in the style set for your game via C++. Both ShooterGame and StrategyGame have an example of doing this.

I realise this is an inconvenience, and it is something we are working to address for a future release.

more ▼

answered Apr 02 '14 at 09:01 AM

avatar image

Jamie Dale STAFF
7.5k 177 67 305

avatar image ReqPro Apr 02 '14 at 10:16 AM

Hi Jamie,

thanks for your response!

I do, indeed, mean the Slate Widget Style asset. I'm sorry to hear that assigning fonts to a style won't currently work, it's kind of a big thing to let the designers choose their appearance instead of having to hardcode font selections into the Style, but be that as it may.

So as I understand it, the Slate styles only work with assets that have been imported into the editor, and can't work with "raw" assets straight from an external file?

Thanks!

avatar image Jamie Dale STAFF Apr 02 '14 at 10:28 AM

"So as I understand it, the Slate styles only work with assets that have been imported into the editor, and can't work with "raw" assets straight from an external file?"

That's not strictly true for games (and is not true at all for the editor, which loads all its content from disk since it doesn't get packaged like a game does), but if you do load things from disk there are considerations that must be taken into account to ensure your content is packaged correctly, so we strongly advise people not to do that where there are alternatives (such as using a Slate Brush asset and a texture asset, rather than loading a texture from disk).

There isn't an alternative for fonts, so loading from disk is currently the way it has to be. You'll need to ensure that any fonts you add are somewhere inside the /Content/Slate directory for your game (you may need to make this) otherwise they won't get packaged correctly.

avatar image ReqPro Apr 02 '14 at 10:58 AM

Hi again, Jamie.

Thanks for the detailed response, that's very helpful to know :)

It makes sense to advise against using the raw files for packaging purposes, I can certainly see where it could cause issues when an asset isn't "registered" for packaging.

Here's hoping for a prompt solution to the problem :)

(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