2

اردو کے فونٹ کے مسائل

假پیچپیچپیچکےف,,,,,،stallyکیکیکیکیکیکی父

我尝试了许多教程/示例和搜索。我找不到解决方案。

  • 提示:(希望它能让某人的生活更轻松。)

我在图像创建中解决的一个大问题是使用 Windows Share-Point 来保存我的 .php 文件。我保存的所有文件都有 UTF BOM。

当我使用简单的记事本以 UTF-8 编码保存相同的文件时,我开始在 PHP 中创建图像。

  • 我的问题。

我在 URDU(南亚 10 亿人使用的语言)中有一个句子,比如说一个字符串 - 以 UTF-8 保存,完美地保存在数据库中并在网络浏览器上显示。

与英语不同,乌尔都语字母加入组成单词,在加入时,它们的外观形状被裁剪 - 大小或样式。

我正在处理这段代码

<?php
function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) { 
    //$SourceFile is source of the image file to be watermarked
    //$WaterMarkText is the text of the watermark
    //$DestinationFile is the destination location where the watermarked images will be placed
    //Delete if destinaton file already exists
    @unlink($DestinationFile);

    //This is the vertical center of the image
    $top = getimagesize($SourceFile);
    $top = $top[1]/2;
    list($width, $height) = getimagesize($SourceFile);

    $image_p = imagecreatetruecolor($width, $height);

    $image = imagecreatefromjpeg($SourceFile);

    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height); 

    //Path to the font file on the server. Do not miss to upload the font file
    $font = 'arial.ttf';

    //Font sie
    $font_size = 36; 

    //Give a white shadow
    $white = imagecolorallocate($image_p, 255, 255, 155);   
    imagettftext($image_p, $font_size, 0, 10, $top, $white, $font, $WaterMarkText);

    //Print in black color
    $black = imagecolorallocate($image_p, 0, 0, 0);
    imagettftext($image_p, $font_size, 0, 8, $top-1, $black, $font, $WaterMarkText);

   if ($DestinationFile<>'') {

      imagejpeg ($image_p, $DestinationFile, 100); 

   } else {

      header('Content-Type: image/jpeg');

      imagejpeg($image_p, null, 100);

   };

   imagedestroy($image); 

   imagedestroy($image_p); 

};

?>

<?php
/*
// The text to draw
    require('../../../I18N/Arabic.php');   //  It converts the  left side language to right side 
    $Arabic = new I18N_Arabic('Glyphs');  // 
    $font = './DroidNaskh-Bold.ttf';
$text = "جب درخشاں ہوں ستاروں کے چراغ";

$text =  $Arabic->utf8Glyphs('جب درخشاں ہوں ستاروں کے چراغ ');
It gave me   ﻍﺍﺭچ ےک ںﻭﺭﺎﺘﺳںﻭہ ںﺎﺸﺧﺭﺩ ﺐﺟ    ,  reversing the string ,  
*/

 $text = "ﻍﺍﺭچ ےک ںﻭﺭﺎﺘﺳںﻭہ ںﺎﺸﺧﺭﺩ ﺐﺟ";   // Problem in joining of Urdu - 

// Text
// Sequence  of characters reversed in string using utf8Glyphs(  ) ; 

$SourceFile = 'nature  (28).jpg';//Source image
$DestinationFile = 'watermarked/sky.jpg';//Destination path 
//Call the function to watermark the image
watermarkImage ($SourceFile, $text, $DestinationFile);

//Display watermarked image if desired
if(file_exists($DestinationFile)){
    echo "<img src=\"watermarked/sky.jpg\">";
    echo "<p>The image has been watermarked at '".$DestinationFile."'</p>";
}
?>

我为其他 UTF-8 即时创建图像工作正常。

亲切的问候。

4

1 回答 1

0

您将需要一个额外的库来执行阿拉伯字形连接。查看 AR-PHP。

于 2015-05-07T11:16:25.633 回答