예제 #1
0
    <p>Information for installing this PECL extension may be found in the manual chapter titled 
        <a href="http://php.net/manual/en/install.pecl.php" target=_blank>Installation of PECL extensions</a>. 
        Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, 
        can be located here: <a href="http://pecl.php.net/package/ming" target=_blank>http://pecl.php.net/package/ming</a>.</p>

    <p>This extension has been moved to the <a href="http://pecl.php.net/" target=_blank>PECL</a> repository and is 
        no longer bundled with PHP as of PHP 5.3.0</p>

    <?php 
    exit;
}
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Glyphs');
$text_before = 'اللغة العربية';
$text_after = $Arabic->utf8Glyphs($text_before);
$f = new SWFFont(dirname(__FILE__) . '/GD/ae_AlHor.ttf');
$m = new SWFMovie();
$m->setRate(24.0);
$m->setDimension(520, 320);
$m->setBackground(105, 121, 47);
/**
 * This functions was based on the example from
 * http://ming.sourceforge.net/examples/animation.html
 *
 * @param integer $r      Red
 * @param integer $g      Green
 * @param integer $b      Blue
 * @param integer $a      Alpha
 * @param integer $rot    Rotate
 * @param integer $x      X
예제 #2
0
파일: Glyphs_PDF.php 프로젝트: m-gamal/crm
/*
 * Needed for fpdf library not for ArPHP library
 */
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
date_default_timezone_set('UTC');
define('FPDF_FONTPATH', 'PDF/font/');
require 'PDF/ufpdf.php';
$pdf = new UFPDF();
$pdf->Open();
$pdf->SetTitle('UFPDF is Cool.');
$pdf->SetAuthor('Khaled Al-Shamaa');
$pdf->AddFont('ae_AlHor', '', 'ae_AlHor.php');
$pdf->AddPage();
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Glyphs');
$text = "\n" . 'العنوان هو "AJAX era!" باللغة الإنجليزية';
$text .= "\n\n" . 'في حقيقة الأمر، لقد سبق لشركة Microsoft ذاتها التعامل مع تقنية Ajax هذه منذ أواخر تسعينات القرن الماضي, لا بل أنها لا تزال تستخدم تلك التقنية في تعزيز مقدرة برنامجها الشهير Outlook للبريد الإلكتروني. وعلى الرغم من كون تقنية Ajax تقنية قديمة العهد نسبيا، إلا أنها لم تلق (حين ظهورها أول مرة) الكثير من الاهتمام، إلا أن الفضل يعود إلى شركة Google في نفض الغبار عنها ولإعادة إكتشافها من جديد، وذلك من خلال طائفة من تطبيقاتها الجديدة والتي يقع على رأسها كل من غوغل Maps إضافة إلى مخدم البريد الإلكتروني Gmail واللذين شكلا فعلا علامة فارقة في عالم الويب وإشارة واضحة إلى ما ستؤول إليه تطبيقات الويب في المستقبل القريب. فهل أعجبتك الفكرة؟ سوريا، حلب في 13 أيار 2007 مـ';
$text .= "\n\nتصحيح طريقة عرض الأرقام المتصلة بأحرف إنجليزية كـ 3M و W3C على سبيل المثال";
$text .= "\n\nخالد الشمعة khaled@ar-php.org والموقع هو http://www.ar-php.org";
// Known bugs:
//$text = 'The title is "عصر الأجاكس!" in Arabic';
//$text = ' مؤسسة (World Wide Web Consortium) W3C';
//$text = ' ماذا لو كانت الجملة تنتهي بكلمة إنجليزية مثل Test?';
$font_size = 16;
$chars_in_line = $Arabic->a4MaxChars($font_size);
$total_lines = $Arabic->a4Lines($text, $font_size);
$text = $Arabic->utf8Glyphs($text, $chars_in_line);
$pdf->SetFont('ae_AlHor', '', $font_size);
$pdf->MultiCell(0, $total_lines, $text, 0, 'R', 0);
$pdf->Close();
$pdf->Output();
예제 #3
0
파일: Glyphs_GD.php 프로젝트: m-gamal/crm
 * @copyright 2006-2016 Khaled Al-Sham'aa
 *
 * @license   LGPL <http://www.gnu.org/licenses/lgpl.txt>
 * @link      http://www.ar-php.org
 */
error_reporting(E_STRICT);
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = @imagecreatefromgif('GD/bg.gif');
// Create some colors
$black = imagecolorallocate($im, 0, 0, 0);
$blue = imagecolorallocate($im, 0, 0, 255);
$white = imagecolorallocate($im, 255, 255, 255);
// Replace by your own font full path and name
$path = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/'));
$font = $path . '/GD/ae_AlHor.ttf';
// UTF-8 charset
$text = 'بسم الله الرحمن الرحيم';
imagefill($im, 0, 0, $white);
imagettftext($im, 20, 0, 10, 50, $blue, $font, 'UTF-8:');
imagettftext($im, 20, 0, 250, 50, $black, $font, $text);
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Glyphs');
$text = 'بسم الله الرحمن الرحيم';
$text = $Arabic->utf8Glyphs($text);
imagettftext($im, 20, 0, 10, 100, $blue, $font, 'Arabic Glyphs:');
imagettftext($im, 20, 0, 250, 100, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
예제 #4
0
파일: db_repo.php 프로젝트: rid50/tawzee
 public function createOwnerSignature($dbh, $ownername, $ownerphone)
 {
     require './I18N/Arabic.php';
     $Arabic = new I18N_Arabic('Glyphs');
     //$font = 'C:\Windows\Fonts\arabtype.ttf';
     $font = '.\\arial.ttf';
     $fontsize = 14;
     $text = $Arabic->utf8Glyphs($ownername);
     //$text = "Abdalla Al Salem";
     // First we create our bounding box for the first text
     $bbox = imagettfbbox($fontsize, 0, $font, $text);
     //throw new Exception(print_r($bbox, true));
     // This is our cordinates for X and Y - center of the image created by imagecreatetruecolor function
     //$x = $bbox[0] + (imagesx($img) / 2) - ($bbox[4] / 2) - 25;
     //$y = $bbox[1] + (imagesy($img) / 2) - ($bbox[5] / 2) - 5;
     $width = $bbox[4] - $bbox[0] + 10;
     $y = $bbox[1] - $bbox[5];
     //$height = $y + 40;
     $height = $y + 10;
     //throw new Exception($width . " ----- " . $height);
     //$width = 184;
     //$y = $height = 24;
     $img = imagecreatetruecolor($width, $height);
     imagesavealpha($img, true);
     $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
     //$trans_colour = imagecolorallocatealpha($img, 255, 255, 255, 127);
     imagefill($img, 0, 0, $trans_colour);
     //$white = imagecolorallocate( $img, 255, 255, 255 );
     //$grey = imagecolorallocate( $img, 128, 128, 128 );
     //$black = imagecolorallocate( $img, 0, 0, 0 );
     $blue = imagecolorallocate($img, 0, 0, 255);
     // Add the text
     imagettftext($img, $fontsize, 0, 0, $y, $blue, $font, $text);
     //$img2 = imagecreatetruecolor($width, $height);
     //imagesavealpha($img2, true);
     //imagefill($img2, 0, 0, $trans_colour);
     //imagecopyresampled($img2, $img, 0, 0, 0, 0, $width, $height, $width * 8, $height * 8);
     imagepng($img, "./my_image.png", 2);
     imagejpeg($img, "./my_image.jpg", 2);
     //$size = getimagesize("./my_image.png", $info);
     //throw new Exception(print_r($size, true));
     ob_start();
     imagepng($img, NULL, 2);
     $imgData = ob_get_contents();
     ob_end_clean();
     //$dbh = $this->connect();
     try {
         $ds = $dbh->query("SELECT EmployeeId FROM SignatureList WHERE EmployeeId = '{$ownerphone}'");
         if ($ds->fetchColumn() == 0) {
             $dbh->exec("INSERT INTO SignatureList(EmployeeId, Image, Width, Height, Resolution) VALUES ('{$ownerphone}', " . $dbh->quote($imgData) . ", {$width}, {$height}, 96)");
         } else {
             $dbh->exec("UPDATE SignatureList SET Image = " . $dbh->quote($imgData) . ", Width = {$width}, Height = {$height} WHERE EmployeeId = '{$ownerphone}'");
         }
     } catch (PDOException $e) {
         throw new Exception('Failed to execute/prepare query: ' . $e->getMessage());
     }
     //		finally {
     imagecolordeallocate($img, $trans_colour);
     //imagecolordeallocate( $img, $white );
     //imagecolordeallocate( $img, $grey );
     //imagecolordeallocate( $img, $black );
     imagecolordeallocate($img, $blue);
     imagedestroy($img);
     imagedestroy($img2);
     //		}
 }
예제 #5
0
$maxChars = 50;
$fontSize = 28;
/*
 * First, convert the text into LTR byte order with line wrapping,
 * Using the Ar-PHP library.
 * 
 * The Ar-PHP library uses the default internal encoding, and can print
 * a lot of errors depending on the input, so be prepared to debug
 * the next four lines.
 * 
 * Note that this output shows that numerals are converted to placeholder
 * characters, indicating that western numerals (123) have to be used instead.
 */
mb_internal_encoding("UTF-8");
$Arabic = new I18N_Arabic('Glyphs');
$textLtr = $Arabic->utf8Glyphs($textUtf8, $maxChars);
$textLine = explode("\n", $textLtr);
/*
 * Set up and use an image print buffer with a suitable font
 */
$buffer = new ImagePrintBuffer();
$buffer->setFont($fontPath);
$buffer->setFontSize($fontSize);
$profile = EposTepCapabilityProfile::getInstance();
$connector = new FilePrintConnector("php://output");
// = new WindowsPrintConnector("LPT2");
// Windows LPT2 was used in the bug tracker
$printer = new Printer($connector, $profile);
$printer->setPrintBuffer($buffer);
$printer->setJustification(Printer::JUSTIFY_RIGHT);
foreach ($textLine as $text) {
예제 #6
0
 /**
  * Draws text on the curren page.
  * 
  * @param int $x X coordinate
  * @param int $y Y coordinate
  * @param int $font_size Font size
  * @param string $text The text to be drawn
  * @param int $alignment PdfDocument::AL_LEFT, PdfDocument::AL_CENTER or PdfDocument::AL_RIGHT
  * @return int Returns the height of the drawn text (to easily change the $y coordinate for the next call)
  */
 public function drawText($x, $y, $font_size, $text, $alignment = self::AL_LEFT)
 {
     if (!$this->currentPage) {
         $this->currentPage = $this->createNewPage();
     }
     $charEncoding = 'UTF-8';
     $this->currentPage->setFont($this->Font, $font_size);
     $text = trim($text);
     $text = str_ireplace("\r\n", "\n", $text);
     $text = str_ireplace("<br/>", "\n", $text);
     $text = str_ireplace("<br>", "\n", $text);
     $text = str_ireplace("<br />", "\n", $text);
     $text = wordwrap($text, 110, "\n", false);
     switch ($alignment) {
         case self::AL_CENTER:
             $x = $x - $this->textWidth($text, $font_size) / 2;
             break;
         case self::AL_RIGHT:
             $x = $x - $this->textWidth($text, $font_size);
             break;
     }
     // spacial handling for multi-line texts
     if (strpos($text, "\n") !== false) {
         $rows = explode("\n", $text);
         foreach ($rows as $row) {
             $row = str_replace("\r", "", $row);
             $this->currentPage->drawText($row, $x, $y, $charEncoding);
             $y -= 12;
         }
         return $this->LineHeight * count($rows);
     }
     /**
      * Handle Arabic text (mantis #6712)
      */
     if (0 < preg_match('/\\p{Arabic}/u', $text)) {
         system_load_module(__DIR__ . "/../../arabic.php");
         $arglyphs = new I18N_Arabic('Glyphs');
         $text = $arglyphs->utf8Glyphs($text);
     } else {
         if (0 < preg_match('/\\p{Hebrew}/u', $text)) {
             $text = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8//IGNORE", $text)));
         }
     }
     $this->currentPage->drawText($text, $x, $y, $charEncoding);
     return $this->LineHeight;
 }