[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 20:03:30 EST 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>&nbsp;</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.&nbsp; The label size does not change using =
either=20
condition:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1. $new_label_size =3D $label_size * =
2;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>or</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2.&nbsp;&nbsp;&nbsp; $new_label_size =
=3D=20
40;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</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>&nbsp;&nbsp;&nbsp; print " &lt;i&gt; The =
layer is :=20
$layer-&gt;name &lt;/i&gt; &lt;br&gt;";</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; $class =3D=20
$layer-&gt;getClass(0);</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; $label_size =3D=20
$class-&gt;label-&gt;size;</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; print " &lt;i&gt; The =
old label=20
size is : $label_size &lt;/i&gt; &lt;br&gt;";</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; //$new_label_size =3D =
$label_size *=20
2;</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; $new_label_size =3D =
40;</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
$class-&gt;label-&gt;size =3D=20
$new_label_size;</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; print " &lt;i&gt; The =
new label=20
size is : $new_label_size &lt;/i&gt; &lt;br&gt;";</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>The layer :</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>LAYER<BR>&nbsp; NAME =
"my_text"<BR><BR>&nbsp; STATUS=20
OFF<BR>&nbsp; DATA "d:/layer/TEXT_text"<BR>&nbsp; TYPE =
ANNOTATION<BR>&nbsp;=20
LABELITEM "TEXTSTRING"<BR>&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; COLOR 255 =
255=20
0<BR>&nbsp;&nbsp;&nbsp; LABEL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
MINFEATURESIZE=20
40<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MINDISTANCE=20
150<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION=20
CC<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 255 255 0</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT=20
arial<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE=20
truetype<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE=20
10<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FORCE TRUE<BR>&nbsp;&nbsp;&nbsp;=20
END<BR>&nbsp; END</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp; METADATA<BR>&nbsp;&nbsp;&nbsp; =
WMS_TITLE=20
"Miscellaneous Text"<BR>&nbsp;&nbsp;&nbsp; WMS_ABSTRACT=20
"N/A"<BR>&nbsp;&nbsp;&nbsp; WMS_SRS "EPSG:26910"<BR>&nbsp; =
END</FONT></P><FONT=20
face=3DArial size=3D2>
<P><BR>END</P>
<P>&nbsp;</P>
<DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Stephen</FONT></DIV>
<P></FONT>&nbsp;</P></DIV></BODY></HTML>

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




More information about the mapserver-users mailing list