using UMG, I’ve noticed there is an option for fonts, but it isn’t using Windows fonts or imported font assets. How do you go about using a custom font with UMG?
Also, a second question, how can I snap a text block to an exact location? for example, I have a title menu and a settings screen, both containing the title of the game, but currently when switching screens, the title text moves slightly as it is placed by hand.
If you just place them into your games Content/Slate/Fonts/ folder they will be cooked, and you can set their path in the UMG editor to just Slate/Fonts/myfont.ttf. No need to put them into Engine content.
For the second part of the question. Be sure to obtain the size of the screen. This way, you can alright by percentages/fractions.
The trick to put stuff in the middle, is that the the ‘Draw Text’ material, will be drawn from left to right always. To solve this use the ‘Get Text Size’ to get the size in pixels, then you can compensate in your size Y and Size X of ‘Draw Text’.
That’s the method you should use for AHUD, not UMG. For UMG, you can place the text object on a canvas, and then anchor it to the top center of the screen and set the horizontal offset to be 0. In order to then align the object at its center at that anchor point, change the Alignment to 0.5, 0.5.
Actually instead of placing it directly onto the canvas, place a Horizontal box down in the canvas first, that contains the text, then you don’t have to worry about sizing the text box. The horizontal box will let you center it easy.
Hi. I added the font in the content foler, and that made the font work in the editor. But, it doesnt work in the standalone build (I get the default font instead). Please help.