TL;DR - scroll to bottom to see how to “fix” GlowFilters for HTML5 targets.
Filters in OpenFL have been a bit buggy the past few releases. The GlowFilter, for example, seems to work well on Flash targets, but not very well in HTML5.
Sample code using Haxe 4 and OpenFL 8.9.7:
var glowFilter:GlowFilter = new GlowFilter(0xff0000, 1, 8, 8, 10);
textField.filters = [glowFilter];
Flash results:
HTML5 results:
I was messing with Starling for Haxe a few days ago and the documentation said if you want a glow filter to resemble a thick stroke, you multiply the alpha parameter by a decent number, like 4 or 8 or 16. In the Flash/OpenFL API documentation states that “valid” values for the alpha parameter are between “0 and 1”. This makes sense for maintaining consistency with Flash render targets, but I got an idea in my head that maybe the alpha could be scaled for HTML5 targets.
Multiplying it by a constant seems to produce better results:
var a:Float = 1;
#if html5
a *= 8;
#end
var glowFilter:GlowFilter = new GlowFilter(0xff0000, a, 8, 8, 10);
textField.filters = [glowFilter];
The new HTML5 results:
Again, this seems to produce nice results with OpenFL 8.9.7 using WebGL, but it could be “fixed” in future implementations, so it might be a good idea to make a wrapper class if you do go this route so it can be easily adjusted.