Re: Asian fonts
| From: | speedboy | Date: | Fri, 02 Nov 2001 11:08:23 +0000 |
| Subject: | Re: Asian fonts | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73248@lists.php.net to get a copy of this message | ||
> Any idea how to use (install) asian fonts on an
> english version of RH? I need them in the gd
> library, to generate an image with chinese/japanese
> text.
Configure php with the following:
--with-gd=/tmp/www/gd-2.0.1
--with-freetype-dir=/usr/local/include/freetype2
--enable-gd-imgstrttf
Then just obtain some chinese/japanese true type fonts and use the
following script below and substitute arial.ttf for the asian font:
<?php
################################################
### draw an image for the header and print some stuff on it.
###############################################
## tell the browser what it is
header("Content-type: image/jpeg");
## draw a new image
$width = 600;
$height = 100;
$image = imagecreate($width, $height);
##make the background same as page
$backg = imagecolorallocate($image, 0, 51, 102);
##make the text white
$text = imagecolorallocate($image, 255, 255, 255);
imagefilledrectangle($image, 0, 0, $width, $height, $backg);
## now let's print some text to the image
imagettftext($image, 40, 0, 60, 75, $text,"/home/www/htdocs/arial.ttf",
"some guy");
## off it goes
imagejpeg($image);
## cleanup
imagedestroy($image);
?>