Hi,

it's not hard to implement everything you want using
IDirectFBFont::GetStringWidth() and then draw one line at a time.
Justification can be done using DSTF_TOPLEFT et al.
Why do you think you can't implement this on top of DirectFB?
For more advanced text rendering you should consider using pango.
You should also remember that the length in bytes may legally be !=
length in characters, since this is UTF-8 encoded text.

hth,
Andre'

On Mon, 2008-01-28 at 14:33 +0100, Alexandre Franke wrote:
> Hi,
> 
> I'd be interested in having what I would call "advanced text
> functions" and which in fact would allow to do more than what is
> currently possible with DrawString.
> 
> What I would like:
> ==================
> 
> First I'd like to have text wrapping. This would take a string (char
> *) and a maxwidth (int) as arguments and would go back to the
> beginning of a new line whenever the width of current line would reach
> maxwidth. An even nicer function would not break words and would only
> make a new line between words.
> 
> Another thing I'd like to have is justified text. Being able to have
> justified wrapped text would be ideal.
> 
> Finally, the last feature I'd like to have is the possibility to
> specify a max width instead of a max length. Currently, DrawString has
> a "bytes" argument that allows to specify max length (a number of
> chars). What I'd like is a way to have a number of pixels instead,
> which would then truncate the string.
> 
> What I have so far:
> ===================
> 
> I have a wrapping function which takes a char* and an int (n, number
> of chars per line) and returns a char** and an int (number of lines).
> It's very basic, it is a loop that goes through the char* and fills a
> table of char* that are at most n chars long.
> 
> The plan:
> =========
> 
> So now the question is, how should I implement things if I am to do
> them on my own?
> 
> I think that the features I'd like can't be implemented on top of
> DirectFB so if I want to implement them, I guess I'll have to put them
> in the DirectFB code. Am I right?
> 
> Can anyone give me any advice?
> 
> Would by any chance someone want to implement them with me (or even do
> it in my place :P)?
> 


_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to