Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5731

Re: Usage of named entities (HTML) in imagettftext

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Usage of named entities (HTML) in imagettftext
Date 2012-04-25 19:17 +0200
Message-ID <9vqptbFvvlU1@mid.uni-berlin.de> (permalink)
References <4f97c160$0$6919$e4fe514c@news2.news.xs4all.nl>

Show all headers | View raw


Am 25.04.2012 11:18, schrieb Erwin Moller:
> 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 &copy;) 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 = " &empty;  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 &copy;, 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: &#8364;) to access
> characters in a font beyond position 127. The hexadecimal format (like &#xA9;) is
> supported. Strings in UTF-8 encoding can be passed directly.
> 
>     Named entities, such as &copy;, 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.
> ======================================================================

I can tell you that the german help does not talk about named entities, it just says

Text ist der auszugebende String, der auch UTF-8-Zeichenfolgen enthalten darf (z.B.
&#123;)

(can have utf-8 sequences like &#123;)

Wrong is also the french and the spanish help. :-)

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Usage of named entities (HTML) in imagettftext Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-04-25 11:18 +0200
  Re: Usage of named entities (HTML) in imagettftext Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-25 08:06 -0400
    Re: Usage of named entities (HTML) in imagettftext Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-04-25 15:34 +0200
      Re: Usage of named entities (HTML) in imagettftext Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-25 09:41 -0400
      Re: Usage of named entities (HTML) in imagettftext Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-25 13:11 -0400
  Re: Usage of named entities (HTML) in imagettftext "Peter H. Coffin" <hellsop@ninehells.com> - 2012-04-25 07:21 -0500
    Re: Usage of named entities (HTML) in imagettftext Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-04-25 14:57 +0200
  Re: Usage of named entities (HTML) in imagettftext "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-25 19:17 +0200
  Re: Usage of named entities (HTML) in imagettftext "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-25 22:49 +0200
    Re: Usage of named entities (HTML) in imagettftext "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-04-26 09:50 +0200

csiph-web