Anti-aliasing bug (with text/labels)

Jani Averbach javerbach at EXTENDTHEREACH.COM
Fri Apr 21 18:01:38 EDT 2006


Hello, 

I have found a bug in Mapserver with anti-aliasing code when 
black text (#000000) is always anti-aliased.

The problem is that there is following kind of code in the 
mapgd.c::msDrawTextGD, around line 3090

...
gdImageStringFT(img, bbox,
((label->antialias)?(label->outlinecolor.pen):-(label->outlinecolor.pen)
),...
...

And the GD Manual says:

   The string is rendered in the color indicated by the gf color index. 
   Use the negative of the desired color index to disable anti-aliasing.

However, for pure black the pen is zero and there isn't such a thing as
negated zero... 
So black text is always anti-aliased regardless of if you are using
ANTIALIAS FALSE or not.
I have included a small map-file to demonstrate that bug.

BR, Jani


MAP
	IMAGETYPE PNG24
	SIZE 100 100 
	EXTENT 0 0 10 10
	UNITS METERS
	FONTSET   "../fonts/fonts.list"
	
	LAYER
		NAME NO_AA
		TYPE ANNOTATION
		STATUS DEFAULT
		FEATURE
			POINTS
				2 5
			END
			TEXT "a8j"
		END
		CLASS
			LABEL
				TYPE TRUETYPE
				FONT arial
				ANTIALIAS FALSE
				SIZE 20
				COLOR 0 0 0 
				#COLOR 1 1 1
			END
		END
	END
END

Jani Averbach
SRC,LLC

SRC in Action:
http://www.DemographicsNow.com

Join SRC at Extend 2006 - Disruptive Technology
June 5-7, 2006 at the Hyatt Regency, Huntington Beach, CA
For more details, click here:  http://www.extendthereach.com/extend06/



More information about the mapserver-dev mailing list