[mapserver-users] High weirdness with msDrawLabelCache() and friends.

Beau Gunderson bludwulf at crackrock.net
Tue Jul 24 16:27:35 EDT 2001


I have a line in my php file that reads:
$classObj->label->set("type", MS_TRUETYPE);

This should be sufficient to set the label's font type to MS_TRUETYPE, and
in fact it does, part of the time.

The problem comes when I try to call drawLabelCache().

I get an error only SOME of the time, which reads:

Fatal error: MapServer Error in msGetBitmapFont(): Invalid bitmap font.
Must be one of tiny, small, medium, large or giant. in
/usr/local/apache/htdocs/loc-dns/buildmap.php on line 92

Obviously, label->type is getting set to something other than MS_TRUETYPE.

I wrote a few msDebug's into maplabel.c to check what was going on. They
look like:
msDebug("msGetLabelSize: label->type = %d, should be %d\n", label->type,
MS_TRUETYPE);

Most of the time they read:
[Tue Jul 24 12:17:58 2001].858842 msGetLabelSize: label->type = 0, should
be 0

(MS_TRUETYPE enumerates to 0, MS_BITMAP enumerates to 1 BTW)

But sometimes, after refreshing, I get:
[Tue Jul 24 12:17:58 2001].898735 msGetLabelSize: label->type =
-2133912937, should be 0
[Tue Jul 24 12:31:51 2001].6434 msGetLabelSize: label->type = 845938944,
should be 0

Obviously something is happening to the information in label->type.

Could this just be a PHP bug?
Also, should the if/else statement really be an if/else if? (else if
label->type == MS_BITMAP) =)

My source is at http://bludwulf-bsd.dyn.dhs.org/loc-dns/buildmap.phps
The mapfile is at http://bludwulf-bsd.dyn.dhs.org/loc-dns/maps/studios.map

Refresh a few times or view
http://bludwulf-bsd.dyn.dhs.org/loc-dns/index.php and then go back to
buildmap.php to see the bug.

-Beau Gunderson




More information about the mapserver-users mailing list