Since nobody answered, I wrote my own function for clipped Text. If anyone is interested, here is my code:
MyHUD.h
//Draw a simple String with drop shadow (CLIPPED)
UFUNCTION(BlueprintCallable, Category = MyHUD)
void TextWithShadow_Clipped(float PosX, float PosY, FText Text, class UFont* Font, FLinearColor TextColor = FLinearColor::White, float Scale = 1.f, float Width = 0.f, float Height = 0.f);
MyHUD.cpp
void MyHUD::TextWithShadow_Clipped(float PosX, float PosY, FText Text, class UFont* Font, FLinearColor TextColor, float Scale, float Width, float Height)
{
FString BaseString, TempString, ClippedString;
TArray<FString> LineArray;
int32 LastSpace, x;
float TextScale, XL, YL, XL_Part, YL_Part;
XL_Part = 0;
YL_Part = 0;
//Match Sizes with the Scale factor
TextScale = Scale * .25f;
Width *= Scale;
Height *= Scale;
//Visualize Clipping Region
//Canvas->Canvas->DrawTile(PosX, PosY, Width, Height, 0, 0, 0, 0, FLinearColor(0.101, 0.062, 0.4, 0.5));
//Convert Text to String
BaseString = Text.ToString();
GetTextSize(BaseString, XL, YL, Font, TextScale);
if (XL > Width)
{
//repeat until BaseString is empty
while (BaseString.Len() >= 1)
{
GetTextSize(BaseString, XL, YL, Font, TextScale);
if (XL > Width)
{
while (XL_Part < Width)
{
TempString = BaseString.Left(TempString.Len() + 1);
GetTextSize(TempString, XL_Part, YL_Part, Font, TextScale);
//Save last known space character
if (TempString.Right(1) == " ")
{
LastSpace = TempString.Len();
}
}
//Add new Line (TempString till space) to the Array
LineArray.Add(TempString.Left(LastSpace));
//Delete the Line from the Base String
BaseString = BaseString.Right(BaseString.Len() - LastSpace);
}
else
{
//Add new Line (whole TempString) to the Array
LineArray.Add(BaseString);
//Delete the whole Base String
BaseString = "";
}
//Empty the required variables for the next loop
TempString = "";
XL = 0;
YL = 0;
XL_Part = 0;
YL_Part = 0;
LastSpace = 0;
}
//Assemble the ClippedString using the LineArray
for (x = 0; x < LineArray.Num(); x++)
{
ClippedString += LineArray[x];
ClippedString += "\n";
}
x = 0;
}
else
{
//If the basic text's width doesen't exceed the width of the Area
ClippedString = BaseString;
}
//Draw final clipped Text
DrawText(ClippedString, FLinearColor(0, 0, 0, 0.5), PosX - 2 * Scale, PosY + 2 * Scale, Font, TextScale, false);
DrawText(ClippedString, TextColor, PosX, PosY, Font, TextScale, false);
}