>
> 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!
>
>
>

Hey, thank you for your quick answer. I'm inclined to the "offscreen pixmap" 
method, but I'm not sure how, excuse me my newbieness. It would involve 
something like a canvas to draw the text to (Fl_Image? Fl_Widget?), and then 
you would draw inside it the text, but how? By overloading draw() and using 
fl_draw(text)? And next, inside the "real" widget where the font originally 
should be drawn, how do I draw that "offscreen pixmap"? Using the fl_draw 
function that has a Fl_Image as a parameter?
I know those are many, and perhaps silly questions, but I couldn't find a 
suitable example among the demos, and I know you said "no examples" ;)
Thank you again!
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to