Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#2357 closed defect (fixed)

msGetLabelSize should use AGG for computing label bounding box

Reported by: tbonfort Owned by: tbonfort
Priority: normal Milestone: 5.4 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 (9)

comment:1 by tbonfort, 16 years ago

initial commit in r7041

comment:2 by dmorissette, 16 years ago

Cc: dmorissette added
Milestone: 5.2 release

comment:3 by tbonfort, 16 years ago

Milestone: 5.2 release5.4 release

comment:4 by tbonfort, 16 years ago

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

comment:5 by tomkralidis, 16 years ago

Cc: tomkralidis added

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

comment:6 by tbonfort, 16 years ago

thanks Tom, fixed in r7585

comment:7 by tbonfort, 16 years ago

Milestone: 5.4 release5.2 release
Resolution: fixed
Status: newclosed

comment:8 by tbonfort, 16 years ago

added a native AGG function to get individual glyph advances, for use with angle follow labels in r7954

comment:9 by dmorissette, 16 years ago

Milestone: 5.2 release5.4 release
Note: See TracTickets for help on using tickets.