How to make a Solid-Color (No Shadow) Text outline?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BAE

I am trying to outline a certain piece of text with a single specific color. This is for a game that has a restricted color pallete.

I have a Label with a theme that modifies the default font. I set the “Outline Color” of the DynamicFont to my desired color and have an Outline size of 2.

Notice the feathering around the outline

However, as it is, the outline is not a solid color - It behaves like a shadow and will make up extra colors to feather out the edges:

How to I modify this so that the outline is a single color?

P.S. There seems to be a property called “Shadow As Outline” which appears to be related to the problem, but changing this value (or any other constants in this category) from the default 0 does not seem to have any effect.

:bust_in_silhouette: Reply From: jstnas

The way I’ve fixed this issue is by stepping the alpha value at a certain threshold. Which means that transparent pixels will be either completely opaque or completely invisible.

shader_type canvas_item;

void fragment() {
    float alpha = texture(TEXTURE, UV).a;
    COLOR.a = step(0.5, alpha);
}

example of transparent outline
before
result of applying the shader
after