【发布时间】:2023-03-06 21:08:02
【问题描述】:
我正在尝试使用一些文本生成图像,并且我编写了以下代码:
<?php
// Set the content-type
header('Content-Type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = '준수';
// Replace path by your own font path
$font = 'fonts/Walkway Black RevOblique.ttf';
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
现在,当我添加带有 English 字符的文本时,它可以工作,但是当我使用 Korean 字符时,它无法正常工作并获取此图像。
知道如何显示韩文吗?
谢谢
【问题讨论】:
标签: php imagettftext