Skip to content

Commit 6233302

Browse files
Merge pull request #329 from TP-David/TextDisableOutline
Disable text outline alpha calculation if width is 0
2 parents 7a9bf4c + 71db484 commit 6233302

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

data/shaders/text.frag

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ vec2 glyph_alpha(vec2 texcoord, vec2 dx, vec2 dy)
2626
float min_distance_from_edge = distance_from_edge - delta;
2727
float max_distance_from_edge = distance_from_edge + delta;
2828

29-
//min_distance_from_edge += 0.0;
3029
min_distance_from_edge += innerCutOff;
3130
float inner_alpha = 0.0;
3231
if (min_distance_from_edge >= 0.0) inner_alpha = 1.0;
3332
else if (max_distance_from_edge >= 0.0) inner_alpha = max_distance_from_edge/(max_distance_from_edge-min_distance_from_edge);
3433

35-
min_distance_from_edge += outlineWidth;
3634
float outer_alpha = 0.0;
37-
if (min_distance_from_edge >= 0.0) outer_alpha = 1.0;
38-
else if (max_distance_from_edge >= 0.0) outer_alpha = max_distance_from_edge/(max_distance_from_edge-min_distance_from_edge);
35+
if (outlineWidth > 0.0)
36+
{
37+
min_distance_from_edge += outlineWidth;
38+
if (min_distance_from_edge >= 0.0) outer_alpha = 1.0;
39+
else if (max_distance_from_edge >= 0.0) outer_alpha = max_distance_from_edge/(max_distance_from_edge-min_distance_from_edge);
40+
}
3941

4042
return vec2(inner_alpha, outer_alpha);
4143
}

0 commit comments

Comments
 (0)