Ticket #2357 (closed defect: fixed)

Opened 11 months ago

Last modified 3 months ago

msGetLabelSize should use AGG for computing label bounding box

Reported by: tbonfort Assigned to: tbonfort
Priority: normal Milestone: 5.2 release
Component: AGG Version: unspecified
Severity: normal Keywords:
Cc: dmorissette, tomkralidis

Description

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.

Change History

11/15/07 08:31:42 changed by tbonfort

initial commit in r7041

03/18/08 09:02:25 changed by dmorissette

  • cc set to dmorissette.
  • milestone set to 5.2 release.

04/17/08 04:07:17 changed by tbonfort

  • milestone changed from 5.2 release to 5.4 release.

05/12/08 12:37:43 changed by tbonfort

updated msGetLabelSize to use a renderer specific function in r7577

these files still use the GD specific function :

  • mapgraticule.c
  • maplegend.c
  • mapscale.c
  • mapsvg.c

05/12/08 18:58:59 changed by tomkralidis

  • cc changed from dmorissette to dmorissette, tomkralidis.

FYI mappdf.c should be updated, here's what I get when I build trunk (r7584) --with-pdf=/usr/local :

mappdf.c: In function 'msDrawLabelPDF':
mappdf.c:454: warning: passing argument 1 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:454: warning: passing argument 2 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:454: warning: passing argument 3 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:454: warning: passing argument 4 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:454: error: incompatible type for argument 5 of 'msGetLabelSize'
mappdf.c:454: error: too few arguments to function 'msGetLabelSize'
mappdf.c: In function 'msDrawLabelCachePDF':
mappdf.c:537: warning: passing argument 1 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:537: warning: passing argument 2 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:537: warning: passing argument 3 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:537: warning: passing argument 4 of 'msGetLabelSize' from incompatible pointer type
mappdf.c:537: error: incompatible type for argument 5 of 'msGetLabelSize'
mappdf.c:537: error: too few arguments to function 'msGetLabelSize'
make: *** [mappdf.o] Error 1

05/13/08 01:21:07 changed by tbonfort

thanks Tom, fixed in r7585

05/29/08 01:46:38 changed by tbonfort

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from 5.4 release to 5.2 release.