php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57816 setFont does not work with all font types as expected
Submitted: 2007-08-30 18:42 UTC Modified: 2007-08-30 19:39 UTC
From: cristobal at furusystems dot com Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.2.1 OS: CentOS release 4.4 (Final)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cristobal at furusystems dot com
New email:
PHP Version: OS:

 

 [2007-08-30 18:42 UTC] cristobal at furusystems dot com
Description:
------------
setFont only works with a small subset of tons or default to 
an default ghoscript font even when specifing an font file or 
an ghoscript library font.

Reproduce code:
---------------
	

	/* Create Imagick Object */
	$im = new Imagick();
	
	/* Create the ImagePixel object  (used to set the background color on image) */
	$im_pixel = new ImagickPixel();
	$im_pixel->setColor( 'cmyk(150,150,100,10)' );
	
	/* */
	/* Create a drawing object and set the font size */
	$im_draw = new ImagickDraw();
	

	// $im_draw->setFontStyle( 0 ); /* 0 .. 4 */ 
	/* Create new empty image */
	$im->newImage( 300, 100, $im_pixel );
	
	/* Set font and font size. You can also specify /path/to/font.ttf */
	//
	$im_draw->setFont( 'New Century Schoolbook' );
	$im_draw->setFontSize( (float)$size );
	/* Write the text on the image */
	$im->annotateImage( $im_draw, 4, 30, 0, $text );
	
	$im_draw->setFont(  'Helvetica'  );
	//$im_draw->setFontSize( (float)$size );
	/* Write the text on the image */
	$im->annotateImage( $im_draw, 4, 80, 0, $text );
	/* Draw the ImagickDraw object contents to the image. */
	$im->drawImage( $im_draw );
	
	/* Give the image a format */
	$im->setImageFormat( $format );
	$base64_encoded = base64_encode($im->getImageBlob( ));
	$im->destroy();
	return $base64_encoded;
	

Expected result:
----------------
I Expect to see an image with the first text in New Century 
Schoolbook
And the second in helvetica, but i get teh same font for both.

I have tried several of the fonts passed with ghostscript font 
library but only a small set of them work.

Actual result:
--------------
I overall only have a small subset of fonts that work from the 
ghostscript font library.

Evenif i specify a an external ttf fonrt it will read it but 
use an other(default) font to write the text.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-30 19:39 UTC] cristobal at furusystems dot com
Hmm seems the issue is with ghostscript library fonts and not 
pear got working my ttf fonts at last.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC