Ticket #3379 (closed defect: fixed)
Crash on using bitmap font and autofollow with mapscript C#
| Reported by: | getiem | Owned by: | tamas |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.0 release |
| Component: | MapScript-C# | Version: | svn-trunk (development) |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I'm running into problems with my mapscript C#. I had truetype fonts, but due to some restrictions I can't use them on the system anymore, so I switched to type Bitmap. This will work, but only if I switch off autofollow.
Case: I have lines with labels. I had these labels with truetype and with autofollow --> MS_TRUE:
Working part: Mapscript:
layerclass.label.color.setRGB(0, 0, 0); layerclass.label.font = "Arial"; layerclass.label.size = 10; //layerclass.label.size = (double)MS_BITMAP_FONT_SIZES.MS_SMALL; layerclass.label.force = mapscript.MS_TRUE; layerclass.label.type = MS_FONT_TYPE.MS_TRUETYPE; //layerclass.label.type = MS_FONT_TYPE.MS_BITMAP; layerclass.label.position = (int)MS_POSITIONS_ENUM.MS_UC; layerclass.label.autoangle = mapscript.MS_TRUE; layerclass.label.autofollow = mapscript.MS_TRUE;
This works.. resulting in mapfile (via mapObj.save()) and image: LABEL
ANGLE FOLLOW ANTIALIAS TRUE FONT "Arial" MAXSIZE 256 MINSIZE 4 SIZE 10 TYPE TRUETYPE BUFFER 0 COLOR 0 0 0 FORCE TRUE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 0 0 PARTIALS TRUE POSITION UC
END
NOT WORKING PART: However, if I change this to using the BITMAP fonttype, It gives me an error: Mapscript: layerclass.label.color.setRGB(0, 0, 0); //layerclass.label.font = "Arial"; //layerclass.label.size = 10; layerclass.label.size = (double)MS_BITMAP_FONT_SIZES.MS_SMALL; layerclass.label.force = mapscript.MS_TRUE; //layerclass.label.type = MS_FONT_TYPE.MS_TRUETYPE; layerclass.label.type = MS_FONT_TYPE.MS_BITMAP; layerclass.label.position = (int)MS_POSITIONS_ENUM.MS_UC; layerclass.label.autoangle = mapscript.MS_TRUE; layerclass.label.autofollow = mapscript.MS_TRUE; Resulting mapfile: LABEL
SIZE SMALL TYPE BITMAP BUFFER 0 COLOR 0 0 0 FORCE TRUE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 0 0 PARTIALS TRUE POSITION UC
END
Resulting Error when calling mapObj.draw() :
Attempted to read or write protected memory. This is often an indication that ot her memory is corrupt. (something with P/Invoke)
Using MS4W with mapserver 5.6.1. Using VS2008.

