[英]PHP imagettftext() with korean characters are not working
我試圖生成帶有一些文本的圖像,並且編寫了以下代碼:
<?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
字符時,則無法工作並獲得此圖像。
知道如何顯示韓文嗎?
謝謝
看起來Walkway Black RevOblique.ttf
不是朝鮮語字體。 嘗試下載並使用韓語版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.