Re: Idea for underlining in GD text functions

From: Date: Sat, 06 Nov 2004 18:30:59 +0000
Subject: Re: Idea for underlining in GD text functions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-13756@lists.php.net to get a copy of this message
Shouldn't you better discuss this with the gd people over at boutell.com? Ron "Tim Toohey" <ttoohey@toowards.com> wrote in message news:20041106062158.78783.qmail@pb1.pair.com... > I've had a need to draw underlines in text created with the GD image > functions, specifically ImagePSText(). As far as I could tell there's no > way to do this (apart from using ImageLine(), which would be difficult to > really get right). [I'm happy to hear suggestions if I've missed the > obvious :-)] > > An added complication of what I wanted to achieve was to underline only part > of the string being drawn, while maintaining kerning between characters. > > The system I've come up with is to embed "control sequences" into the string > that is passed to ImagePSText(). A control sequence contains commands which > change various characteristics of the output, for instance, toggle > underlining. I'm currently using the escape character (chr(27)) to indicate > the start of a control sequence, and a semi-colon to end the sequence. > > For example: > $str="Some text with an " . chr(27) . "u;underlined" . chr(27) . "u; word"; > > I've attached a patch for gd.c which does what I'm talking about. > > I wondering whether people think this is a good way to go, and if so if I > should commit this code? If it's not a good idea, any suggestions for > drawing underlines? > > Thanks, > Tim >

« previous php.internals (#13756) next »