msGetLabelSize currently uses a call to gdImageStringFT to get the bounding box of a label. There are a few discrepancies between the way AGG and GD render font glyphs, resulting in the size of a label being different by a few pixels depending on the renderer.
Symptoms:
- As the bounding box is used to select/discard which labels are drawn depending on the space they take, there could be some overlap of labels or labels that could be drawn but are discarded when using the AGG renderer.
- The bounding box is used to draw a solid rectangle behind the label if BACKGROUNDCOLOR is specified. With AGG this rectangle is sometimes incorrect by a few pixels.
- The glyphs have to be read and cached twice (once by GD, once by AGG), resulting in a slight loss of performance.
Fix:
- the agg renderer should provide a function for computing the bounding box of a label, and msGetLabelSize should call that function when using an AGG outputformat.