FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Usage of named entities (HTML) in imagettftext
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Usage of named entities (HTML) in imagettftext [message #177877] Wed, 25 April 2012 09:18 Go to previous message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma:
Senior Member
Hello,

I just found something strange in the documentation (or my understanding
of it).
During some modification I am making to an older project I found I was
using named entities (like ©) during true type font rendering.
And that shouldn't work, according to the documentation, but it does
work just fine.

The function imagettftext(...) will write a text on an image-resource
using a True Type font.

Here follows a code snippet:
$inImgText = " ∅ 50 mm)";
imagettftext($myImg, $size, 0, $x, $y, $black, $font,$inImgText);

(I left not related code out.)

The result is the text: ∅ 50 mm appearing on the image, as intended.
(In case the characters didn't survive it to your newsreader, that is
DIAMETER symbol, followed by 50 mm)

But according to the documentation it shouldn't.
It clearly states "Named entities, such as ©, are not supported.".
(Relevant part copied hereunder)

What am I missing here?
Or is the documentation wrong and ARE named entities supported?

(I am using PHP 5.2.0 on this system)

Thanks for your time.

Regards,
Erwin Moller


[source]
http://nl3.php.net/manual/en/function.imagettftext.php
======================================================================
TEXT
The text string in UTF-8 encoding.

May include decimal numeric character references (of the form:
€) to access characters in a font beyond position 127. The
hexadecimal format (like ©) is supported. Strings in UTF-8 encoding
can be passed directly.

Named entities, such as ©, are not supported. Consider using
html_entity_decode() to decode these named entities into UTF-8 strings
(html_entity_decode() supports this as of PHP 5.0.0).

If a character is used in the string which is not supported by the
font, a hollow rectangle will replace the character.
======================================================================


--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What happens when i dont use the semicolon for closing my statement
Next Topic: Data injection problems
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 11:56:24 GMT 2024

Total time taken to generate the page: 0.04002 seconds