[MS4W-Users] Use of fonttype bitmap and autofollow in C# mapscript 5.6.1
Tiemens, Gerben
Gerben.Tiemens at grontmij.nl
Wed Mar 17 08:14:58 EST 2010
Hello all,
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 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:
Attempted to read or write protected memory. This is often an indication that ot
her memory is corrupt.
(something with P/Invoke)
Is this a bug, or is it just nog possible to get autofollow labels with bitmap type labels? Or is it Csharp errors with bitmap font?
Greetings
Gerben Tiemens
<< Please read our E-mail Disclaimer at: Emaildisclaimer.Grontmij.com >>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ms4w-users/attachments/20100317/c024ac29/attachment.htm
More information about the MS4W-Users
mailing list