unable to change the layer font

Dylan Keon dbkeon.ml at GMAIL.COM
Tue Jan 24 12:53:35 PST 2006


On 1/24/06, krishna S <kris_rock82 at yahoo.com> wrote:
> Hello all, i am using php mapscript to label the layer on a map, i am able
> to set it from the mapfile but when i do it from the php mapscript file it
> doesnt change the font and the font size, heres how the php mapscript looks
> like
>
> $map = ms_newMapObj($map_path."states.map");
>
> $layername = $map->getLayerByName("states");
> $layername->set("labelitem","cty_county");
> $class = $layername->getClass(0);
> $style = ms_newStyleObj($class);
> $style->backgroundcolor->setRGB(255,255,255);
> $style->color->setRGB(100,220,220);
> $style->outlinecolor->setRGB(100,0,0);
>
> $class1 = ms_newClassObj($layername);
> $class1->label->set("font","verdana");
> $class1->label->set("size","tiny");
>
> Even though i comment the font and size attributes in the mapfile, it shows
> me the default output but not the changes that i want with the font and the
> font size.
>
> Any suggestions please ...
>
> --kris

LOL - I just replied to your other email.  If you want to use a
truetype font you need to do the following:

$class1->label->set(type, MS_TRUETYPE);
$class1->label->set(size, 8);

You must define the font type as truetype, and give it an integer size.

--Dylan



More information about the MapServer-users mailing list