Opened 16 years ago

Closed 16 years ago

#2403 closed defect (fixed)

entity encoding fails with angle follow text

Reported by: tbonfort Owned by: tbonfort
Priority: normal Milestone: 5.2 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc: dmorissette, sdlime

Description (last modified by tbonfort)

GD text rendering by default supports entity encoded text (eg: { é ...)

there's a problem with how these strings are split up glyph by glyph for angle follow text, as for text containing these encodings, msGetLabelSizeEx returns the size of gd rendered glyphs (i.e. é counts for one glyph) whereas the string is split into individual chars when computing the label points.

there's potential for segfaults here as in that case we're fetching label point values outside of what was returned by gd (mapserv segfaults for me, but not shp2img)

example with angle follow vs. angle auto:

http://trac.osgeo.org/mapserver/browser/trunk/msautotest/misc/expected/encoded_follow_text_entity_bug.png

Change History (7)

comment:1 by tbonfort, 16 years ago

partially fixed in r7051 . pure html entities ( eg & ) are still not supported. how should we treat this:

  • #include <entities.h> from gd (contains the html to unicode mappings)
  • make our own entities.h
  • ignore the problem

?

comment:2 by tbonfort, 16 years ago

Description: modified (diff)

comment:3 by sdlime, 16 years ago

Can't really ignore it I think. Perhaps having our own copy makes the most sense. With that how easy a change is it to support HTML entities? BTW I like your changes.

Steve

comment:4 by dmorissette, 16 years ago

I agree that we need to do something about this. At a very minimum the code needs to be fixed so that it doesn't seg fault.

Since GD is currently required by MapServer it may be sufficient to #include <entities.h> for now (does GD have a lookup function we could call?) and if we ever make GD optional we can derive our own entities table at that time.

comment:5 by dmorissette, 16 years ago

Milestone: 5.2 release

in reply to:  4 comment:6 by tbonfort, 16 years ago

Since GD is currently required by MapServer it may be sufficient to #include <entities.h> for now (does GD have a lookup function we could call?) and if we ever make GD optional we can derive our own entities table at that time.

I'll be #including entities.h for the time being as it's easier ;) . I don't think it'll be a problem to include our own entities.h if a problem occurs, at it isn't licensed according to gd license (it is generated automatically by entities.tcl).

there's no gd function to extract these entities, I rewrote it and put it in the same function as the decimal entity extraction function. There's a bug in gd that still affects one entity (&thetasym;) so that glyph won't be rendered with gd. I've opened a bugreport on libgd.org , but it won't cause a segfault for mapserver, so we're safe even if it isn't fixed soon.

With that how easy a change is it to support HTML entities?

it's rather trivial, and fits in the same way as decimal entities

committed in r7053

comment:7 by tbonfort, 16 years ago

Resolution: fixed
Status: newclosed

grr... the mac buildbot doesn't like reusing entities.h , and only for csharp :(

so we now have a mapentities.h which is slightly modified version of gd's entities.h in the source tree since r7055

closing

Note: See TracTickets for help on using tickets.