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

Stephen Clark stephen.clark at focus.ca
Tue Feb 3 17:03:30 PST 2004


This is a multi-part message in MIME format.

------=_NextPart_000_0215_01C3EA77.A62BC500
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 =3D $label_size * 2;

or

2.    $new_label_size =3D 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 =3D $layer->getClass(0);

    $label_size =3D $class->label->size;

    print " <i> The old label size is : $label_size </i> <br>";

    //$new_label_size =3D $label_size * 2;

    $new_label_size =3D 40;

    $class->label->size =3D $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


------=_NextPart_000_0215_01C3EA77.A62BC500
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Below is a piece of code that I am =
working on to=20
change the size of labels.  The label size does not change using =
either=20
condition:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>1. $new_label_size =3D $label_size * =
2;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>or</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>2.    $new_label_size =
=3D=20
40;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Is there some function I am missing =
like a set(...)=20
function ??</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT> </DIV>
<DIV>
<P><FONT face=3DArial size=3D2>if (some condition)</FONT></P>
<P><FONT face=3DArial size=3D2>{</FONT></P>
<P><FONT face=3DArial size=3D2>    print " <i> The =
layer is :=20
$layer->name </i> <br>";</FONT></P>
<P><FONT face=3DArial size=3D2>    $class =3D=20
$layer->getClass(0);</FONT></P>
<P><FONT face=3DArial size=3D2>    $label_size =3D=20
$class->label->size;</FONT></P>
<P><FONT face=3DArial size=3D2>    print " <i> The =
old label=20
size is : $label_size </i> <br>";</FONT></P>
<P><FONT face=3DArial size=3D2>    //$new_label_size =3D =
$label_size *=20
2;</FONT></P>
<P><FONT face=3DArial size=3D2>    $new_label_size =3D =
40;</FONT></P>
<P><FONT face=3DArial size=3D2>    =
$class->label->size =3D=20
$new_label_size;</FONT></P>
<P><FONT face=3DArial size=3D2>    print " <i> The =
new label=20
size is : $new_label_size </i> <br>";</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2></FONT> </P>
<P><FONT face=3DArial size=3D2>The layer :</FONT></P>
<P><FONT face=3DArial size=3D2></FONT> </P>
<P><FONT face=3DArial size=3D2>LAYER<BR>  NAME =
"my_text"<BR><BR>  STATUS=20
OFF<BR>  DATA "d:/layer/TEXT_text"<BR>  TYPE =
ANNOTATION<BR> =20
LABELITEM "TEXTSTRING"<BR>  CLASS<BR>    COLOR 255 =
255=20
0<BR>    LABEL<BR>      =
MINFEATURESIZE=20
40<BR>      MINDISTANCE=20
150<BR>      POSITION=20
CC<BR>      COLOR 255 255 0</FONT></P>
<P><FONT face=3DArial size=3D2>      FONT=20
arial<BR>      TYPE=20
truetype<BR>      SIZE=20
10<BR>      FORCE TRUE<BR>   =20
END<BR>  END</FONT></P>
<P><FONT face=3DArial size=3D2>  METADATA<BR>    =
WMS_TITLE=20
"Miscellaneous Text"<BR>    WMS_ABSTRACT=20
"N/A"<BR>    WMS_SRS "EPSG:26910"<BR>  =
END</FONT></P><FONT=20
face=3DArial size=3D2>
<P><BR>END</P>
<P> </P>
<DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Stephen</FONT></DIV>
<P></FONT> </P></DIV></BODY></HTML>

------=_NextPart_000_0215_01C3EA77.A62BC500--




More information about the MapServer-users mailing list