����������
WEB - ������

www.spravkaweb.ru Rambler's Top100
 ï¿½ï¿½ ����������: �������/PHP/������ � ������������� � ���������� GD.������ �� �������� TrueType � PostScript Type 1Ðàñïå÷àòàòü 
�������
�������
����� ���
HTML
JavaScript
VBScript
CSS
Flash
Perl
PHP
MySQL
SSI
VRML
�������������
������
Download
�����
��������
������
�������� ���
�����:
��������
Subscribe.Ru:

PHP

<--����� | ��������� � ������ | ������-->
������ � ������������� � ���������� GD
������ �� �������� TrueType � PostScript Type 1
���������� GD ������������ ����� ������ �� �������� PostScript � TrueType. ��� ���� ����� ���������� ����������� ���� �������, PHP ������ ���� �������������� � ���������� ������ � ����������� FreeType, ��������� �� ������ https://www.freetype.org. � Windows-������ PHP ��� ����������� �� ���������.
imageTTFText
��������� ������ ������� TrueType.

��������� :
array imageTTFText(int im, int size, int angle, int x, int y, int color, string fontfile, string text)

��� ������� �������� ������ text � ����������� im ������ color. ��� ������, color ������ ������������ ����� ���������� ������������� �����. �������� angle ������ ���� ������� � �������� ��������� ������, ������������� �� ����������� ������ ������� �������. ���������� (x, y) ��������� ��������� ��� ���������� ������� ����� ������ (������ ��� �� ����� ������ ����). �������� size ������ ������ ������, ������� ����� �������������� ��� ������ ������. fontfile ������ ��������� ��� TTF-�����, � ������� � ��������� �����.

������� ���������� ������ �� 8 ���������. ������ �� ���� ������ ���������� (x,y) �������� ������ ���� ��������������, ���������� ������ ������ ������ � �����������, ������ ���� - ���������� �������� ������� ����, � �.�. ��� ��� � ����� ������ ������ ����� ����� ����� ������ angle, ����� ��������� 4 ���� ���������.

������ ������ text ����� ��������� ���������� ������������������ UTF-8 (� ���� &#123;) ��� ������ �������� � ������, �������� 255.

��� ������������� �������������� �������� ������� ����� color ����������� ����������� ������ (antialiasing).

������ ������� ������� ���������� GD � FreeType.

<?php
  header("Content-type: image/jpeg");
  $im = imagecreate(400, 30);
  $white = imagecolorallocate($im, 255, 255, 255);
  $black = imagecolorallocate($im, 0, 0, 0);
  
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black, "/path/arial.ttf",
  "Testing... Omega: &#937;");
  imagejpeg($im);
  imagedestroy($im);
?>
��������� ������ ������� ������ �� ������ �������
<?php
$gi = imageCreate(200,100);
$bg = imageColorAllocate($gi,0,220,0);
$tx = imageColorAllocate($gi,25,2,228);
$w = imageSX($gi); // ������ �������
$h = imageSY($gi); // ������ �������
imageFilledRectangle($gi,0,0,$w,$h,$bg);

$szf = 20; // ������ ������
$ang = 240; // ���� �������� ������
$str = "Heyou"; // ����� ������
$font = "symbol.ttf" // ���� ������
$sz = imageTTFBBox($szf,$ang,$font,$str);
$sdx = $sz[4]/2;
$sdy = ($sz[7]+$sz[3])/2;
imageTTFText($gi,$szf,$ang,$w/2-$sdx,$h/2-$sdy,$tx,$font,$str);
Header("Content-Type: image/png");
imagePng($gi,"file.png");
?>

imageTTFBBox
������ �������, ���������� ������� ������ TrueType.

��������� :
attay imageTTFBBox(int size, int angle, string fontfile, string text)

��� ������� ������ �� ������� � �����������, � ������ ����������, ����� ������ � ��������� ������ �� ������ ������ text ������� size, ���������� ��� ����� angle � �����-������ �������. �������� fontfile ������ ���������� ���� � ����� ������, ������� ����� ����������� ��� ������.

������������ ������ �������� ��� ���������� � �������� ������ � �������, ������� �� ���, ��� ������ ������� imageTTFText(). ������ ������� ����� � ��� ����������.

���������� �������, ������������� �������� imageTTFBBox():

0 � 1 - (x,y) ������ ������� ����
2 � 3 - (x,y) ������� ������� ����
4 � 5 - (x,y) ������� �������� ����
6 � 7 - (x,y) ������ �������� ����

���������� ����� ����� ������������� ��������.
������� ������� ���������� GD � FreeType.


imagePSLoadFont
�������� �� ����� ������ PostScript Type 1.

��������� :
int imagePSLoadFont(string filename)

���������� ���������� ������������ ������ ��� FALSE ��� ������ (����� ��������� ��������������).

<?php
header("Content-type: image/jpeg");
$im = imagecreate(350, 45);
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
$font = imagepsloadfont("bchbi.pfb"); // or locate your .pfb files on your machine
imagepstext($im, "Testing... It worked!", $font, 32, $white, $black, 32, 32);
imagepsfreefont($font);
imagejpeg($im, "", 100); //for best quality...your mileage may vary
imagedestroy($im);
?>
��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.

imagePSFreeFont
�������� ������ PostScript Type 1.

��������� :
void imagePSFreeFont(int fontindex)

������ ������� ����������� ������ �� ������, ��������� ���������� fontindex.
��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.


imagePSEncodeFont
��������� ����� ������������� ������.

��������� :
int imagePSEncodeFont(int font_ndex, string encodingfile)

��������� ���� ������������� encodingfile ��� ������ font_index. ��������� ������ PostScript �� ��������� �� ���������� ������� � ������, �������� 127, ������������� ��������� ��� ������������� ������������� �� ����������� �����. ������ ����� ������ � ������������ Tllibs, ����� � ����������� ������������ 2 ������� �����: IsoLatinl.enc � IsoL.atin2.enc.

���� ������������� ������������ ���������, ���������� �������� ps.default_encoding � ����� ������������ �� ��������� ����� ����� �������������, ������� ����� ����������� �������������.

��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.


imagePsExtendFont
��������������� ������.

��������� :
bool imagePsExtendFont (int font_index, float extend)

������� ���������� ���������� ��� ������ ������, ��������� ���������� font_index �� �������, ��������� ���������� extend.
���� �������� ��������� extend ������ 1, �� ����� ����� �����������.

��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.


imagePsSlantFont
��������� ������� ������.

��������� :
bool imagePsSlantFont(int font_index, double slant)

������� ������������� ������ ������ font_index � ��������, �������� ���������� slant.

��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.


imagePSBBox
������ �������, ���������� ������� ������ PostScript Type 1.

��������� :
array imagePSBBox( string text, int font, int size [, int space [, int tightness [, float angle]]])

������� ������������ �� ��������� ����������:
size - ������ ������ � ��������;
space � ��������� ������� �������� �� ��������� � ����������� (����� ���� �������������);
tightness � ���������� ����� ��������� �� ���������) � ����������� (����� ���� �������������);
angle � ���� ������� ������ � ��������.

�������� space � tightness ���������� � ����� ������� (1/1000).
��������� space, tightness, angle �� �����������.

���������� ������� ������������ �����. ������� ���������� ������:

  • 0 - ������ ����� ����, �-����������;
  • 1 - ������ ����� ����, Y-����������;
  • 2 - ������� ������ ����, �-����������;
  • 3 - ������� ������ ����, Y- ����������.
  • ��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.


    imagePSText
    ����� ������ ������ ������� ������� PostScript Type 1.

    ��������� :
    array imagePSText ( resource image, string text, int font, int size, int foreground, int background, int x, int y [, int space [, int tightness [, float angle [, int antialias_steps]]]])

    �������� size ������ ������ ������.
    ���������� x, � ��������� ����� ������ ���� ������� �������.
    ����������� foreground � background �������� ����� ������ � ���� (��� ��������� ������ ��� ����������� ������).
    �������� antialias_steps ��������� ������� ����� ������, ������������ ��� ����������� ������ (���������� �������� 4 � 16). ��� ������� �������� ������ 20 ����������� ������� ��������, ��� ��� ��� �������� �������������; ��� ������� ������� ����������� ������� ��������, ��� ��� ��� ����������� ��������������.
    �������� angle ������ ������ ������ � ��������.
    ������� ���������� ������, ������� imagepsbbox().

    ��� ������� �������� ������ � ��� ������, ���� PHP ��� ������������� � ������ --enable-t1lib.

    �� ���������� ����� ����� ������� "PHP 4. ����������� ����������."
    www.piter.com
    ������ / � ����������
     
    Download
    Ñêà÷àòü ñïðàâî÷íèê ïî PHP
    ��� ������:
    05.07.2004
  • � ������� PHP ��������� ��������� ������� ��� ������ � ���������� (���������� GD):
    imagetypes(), ...
  • � ������� JavaScript ��������� �������� �� ����� D, E, F, H, I
  • � ������� ������ ��������� ������, �������������� ��� �������� � html-�������� ��������� MS Office (Word, Excel � �.�.)
  • �����������:
    ���� ������ � �����:
    ������ �����!
    ����������.
    ��� ����.
    ��� ��� �����.
    ������.
    ���� �� �����!
    ��������:
    Rambler's Top100
    Ñäåëàòü ñòðàíèöó ñòàðòîâîé ������� �������� ���������
    Äîáàâèòü ñòðàíèöó â èçáðàííîå �������� ���� � ���������
    Ñîîáùèòü îá íàéäåííîé îøèáêå �������� �� ������