Opened 13 years ago

Last modified 12 years ago

#4013 assigned defect

Font rendering with transparency in PNGs using PC256

Reported by: posthumusb Owned by: sdlime
Priority: normal Milestone:
Component: Renderer API Version: 6.0
Severity: normal Keywords:
Cc: dmorissette, sdlime

Description

Version: MapServer 6.0.1 (from MS4W 3.0.1) OS: Windows XP Pro SP3

In MapServer 6.0, output PNGs using IMAGEMODE PC256 and TRANSPARENT ON in the output format results in corrupted text when rendering truetype fonts. This worked fine in MS 5.4 and 5.6.

Here is the output format causing this issue:

OUTPUTFORMAT
  NAME png256
  DRIVER "GD/PNG"
  MIMETYPE "image/png"
  IMAGEMODE PC256
  EXTENSION "png"
  TRANSPARENT ON
END

Attached is a stand-alone mapfile with a truetype font and font-list file. Resulting PNGs using MS 5.4 and MS 6.0 are also included for comparison.

This issue was first raised in this post: http://osgeo-org.1803224.n2.nabble.com/Font-rendering-in-MapServer-6-0-tt6555935.html

Though using the AGG renderer is an option, it creates new challenges when working with Internet Explorer 6 (see http://osgeo-org.1803224.n2.nabble.com/Rendering-with-a-single-transparent-colours-in-MapServer-6-tt6769109.html). Having a fully functional PC256 option would alleviate this problem.

Attachments (2)

fontRenderingBug.zip (43.5 KB ) - added by posthumusb 13 years ago.
Mapfile showing font rendering bug using PC256 with transparency
mapserverTicket4013 (879 bytes ) - added by posthumusb 13 years ago.
mapgd.c patch for ticket 4013

Download all attachments as: .zip

Change History (8)

by posthumusb, 13 years ago

Attachment: fontRenderingBug.zip added

Mapfile showing font rendering bug using PC256 with transparency

comment:1 by dmorissette, 13 years ago

Cc: dmorissette added
Component: WMS ServerRenderer API
Owner: changed from mapserverbugs to tbonfort

Rendering issue. Reassigned to tbonfort.

comment:3 by tbonfort, 13 years ago

Cc: sdlime added

ccing Steve as he's the GD expert

by posthumusb, 13 years ago

Attachment: mapserverTicket4013 added

mapgd.c patch for ticket 4013

comment:4 by posthumusb, 13 years ago

In mapgd.c, there's a condition that converts the background colour to purple (117,17,91) if either the background colour does not exist, is not valid, OR transparency is turned on. This purple colour is bleeding into the text around the edges, causing the jagged appearance of the text.

I've attached is a potential patch that sets the background to (117,17,91) only if the background colour does not exist or is invalid, and then worries about transparency later. This fixes the issue, though I can't say if it breaks something that maybe was relying on the purple background (hopefully not).

comment:5 by posthumusb, 12 years ago

Steve or Thomas, can either of you have a spare moment, can you take a look at the patch submitted? It's a small fix that has been working well for me over the last month or so, but maybe it doesn't work for all scenarios that one of you would know of.

comment:6 by sdlime, 12 years ago

Owner: changed from tbonfort to sdlime
Status: newassigned
Note: See TracTickets for help on using tickets.