That’s correct, Canvas will use the first font unless you specify otherwise.
Specifying which font to use for a HUD is a little cumbersome though, as AHUD
doesn’t have a function that takes a FCanvasTextItem
, so you’ll have to use the underlying Canvas directly… something like this:
if (IsCanvasValid_WarnIfNot())
{
FCanvasTextItem TextItem(FVector2D(PosX, PosY), YourText, FSlateFontInfo(Font, FontSize,"Italic"), FLinearColor::White);
Canvas->DrawItem(TextItem);
}
It’s fine to use composite fonts in C++, however they are best supported by Slate/UMG, rather than Canvas/HUD, and we recommend that UMG or Slate be used for any non-debug UIs.