[Mapserver-users] would like some help to dynamically change the size of TTF fonts using php mapscript

woodbri at swoodbridge.com woodbri at swoodbridge.com
Tue Feb 3 17:32:58 PST 2004


Try

$class->label->set("size", $new_label_size);

-Steve

On 3 Feb 2004 at 17:03, Stephen Clark wrote:

> Hi all,
> 
> Below is a piece of code that I am working on to change the size of labels.  The label size does not change using either condition:
> 
> 1. $new_label_size = $label_size * 2;
> 
> or
> 
> 2.    $new_label_size = 40;
> 
> Is there some function I am missing like a set(...) function ??
> 
> 
> 
> if (some condition)
> 
> {
> 
>     print " <i> The layer is : $layer->name </i> <br>";
> 
>     $class = $layer->getClass(0);
> 
>     $label_size = $class->label->size;
> 
>     print " <i> The old label size is : $label_size </i> <br>";
> 
>     //$new_label_size = $label_size * 2;
> 
>     $new_label_size = 40;
> 
>     $class->label->size = $new_label_size;
> 
>     print " <i> The new label size is : $new_label_size </i> <br>";
> 
> }
> 
> 
> 
> The layer :
> 
> 
> 
> LAYER
>   NAME "my_text"
> 
>   STATUS OFF
>   DATA "d:/layer/TEXT_text"
>   TYPE ANNOTATION
>   LABELITEM "TEXTSTRING"
>   CLASS
>     COLOR 255 255 0
>     LABEL
>       MINFEATURESIZE 40
>       MINDISTANCE 150
>       POSITION CC
>       COLOR 255 255 0
> 
>       FONT arial
>       TYPE truetype
>       SIZE 10
>       FORCE TRUE
>     END
>   END
> 
>   METADATA
>     WMS_TITLE "Miscellaneous Text"
>     WMS_ABSTRACT "N/A"
>     WMS_SRS "EPSG:26910"
>   END
> 
> 
> END
> 
> 
> 
> thanks
> Stephen
> 
> 





More information about the MapServer-users mailing list