On 8 Jun 2010, at 15:33, Leandro Fanzone wrote:

> Hello, I began developing using FLTK, and so far so good. What I  
> want to do now is to draw text but using a different "aspect ratio"  
> than the one provided by the font I use. For example, I would like  
> to draw the letter "A" using twice the width it uses by default,  
> stretching the character. I'm using currently fl_draw(...); though  
> there are some overloads to this function that take width and  
> height, they still draw the font "as is": I can't deform the text.
> I would appreciate any hint, thank you in advance.

Fltk doesn't really provide any mechanism to deform the text in  
regular rendering (though if you were to set a transform matrix on  
the draw context, that *might* work, sometimes, on some platforms, I  
suspect...)

Instead, we just wrap the native font handling of each platform - and  
that need to be cross-platform limits the features we can expose to a  
"lowest common denominator" subset of the things you might want...

What I would do would be to render the text "normal" size into an  
offscreen pixmap, then blit that into the display context with a 2:1  
scaling in the width axis. That should be pretty quick and cheap to  
do, I think.
Don't think I've got any examples lying around of doing that though,  
but the basic idea is pretty straightforward.

An alternative approach might be to render the text via OpenGL, then  
you could transform it using the GL mechanisms, which ought to allow  
some considerable scope for stretching and scaling I imagine!



_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to