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"

[BUG] FCanvasTextItem::Draw - outline behind shadow

I've implemented a custom HUD class in order to draw text with outline and shadow (the "Draw Text" blueprint function does not have these parameters).

This is my (unfinished) function:

 void DrawFancyText(const FString& Text, FVector2D Position, UFont* TextFont, FVector2D FontScale, FColor TextColor){
     float XL, YL;
     Canvas->TextSize(TextFont, Text, XL, YL);
     const float X = Canvas->ClipX / 2.0f - XL / 2.0f + Position.X;
     const float Y = Canvas->ClipY / 2.0f - YL / 2.0f + Position.Y;
     FCanvasTextItem TextItem(FVector2D(X, Y), FText::FromString(Text), TextFont, FLinearColor(TextColor));
     TextItem.bOutlined = true;
     TextItem.OutlineColor = FLinearColor(0.5, 0.4, 0.7);
     TextItem.EnableShadow(FLinearColor::Black, FVector2D{ 2 * FontScale.X, 2 * FontScale.Y });
     TextItem.Scale = FontScale;

I noticed that the outline is drawn behind the shadow, like so: alt text

I traced this back to the FCanvasTextItem::Draw function which draws the outline first, and then the shadow on top of it. I'm pretty sure this is not the intended behavior.

Here is a project reproducing this issue.

Product Version: UE 4.9
text.png (25.1 kB)
more ▼

asked Sep 29 '15 at 08:29 PM in Bug Reports

avatar image

26 1 4

avatar image Matthew J Oct 01 '15 at 02:56 PM

Hello Astronovice,

Thank you for taking the time to report this issue. I believe you're correct in saying that this is a bug and I would like to report it. I will need a reproduction case however and it would be very helpful if you could provide me with such, as it would take quite a bit of time to attempt to recreate your custom function and everything around it. Could you upload the existing project or a sample project with this problem inside of it? If you wish for it to remain private you can send it to me in a Private Message on the forums.

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

1 answer: sort voted first

Hello, and thanks for replying.

I'll create a small project that reproduces the issue, and add it to the original post. I've also opened a pull request on the github repository since I believe the fix is simple. Does it have any chance of being reviewed or even merged?

Thanks again.

more ▼

answered Oct 01 '15 at 03:32 PM

avatar image

26 1 4

avatar image Matthew J Oct 01 '15 at 03:49 PM

I can guarantee that it will be reviewed at some point, but as to when it'll be and if it'll be merged, I'm not sure. If the change fixes the issue and doesn't pose any others, it will be merged. Since you made a Pull Request, it's already logged in our database so there isn't much reason in me placing a bug in for it. If you wish however, I can still attach the project that you provide to give a repro case for it.

avatar image Astronovice Oct 01 '15 at 04:21 PM

Thanks again for the quick reply. Here is a project reproducing the issue: https://github.com/alexpana/ue_hud_canvas_bug

(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