Sign in to follow this  

Drawing text upside down with GDI

This topic is 3601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm using the TextOut function to draw normal text. However now I want to draw some text upside down. What is the best way to achieve that? Thanks in advance

Share this post


Link to post
Share on other sites
The right way to do this, I think, is to create a font that would output text flipped vertically. To do this, fiddle with the nOrientation and nEscapement arguments of a call to the CreateFont() API. You will possibly need to reverse the printed string as well before calling DrawText().

If that fails, then you can create a memory bitmap large enough to hold the printed text (use the DT_CALCRECT flag on a call to DrawText() to determine the required size), associated with a memory DC, call DrawText() on that DC, then blit the result to the final output DC with a call to StretchBlt() and a negative height (which would flip it vertically).

I'm curious though... why would you need text printed upside down?

Share this post


Link to post
Share on other sites
Thanks, setting lfOrientation and lfEscapement to 180 * 10 worked fine. The x,y values for TextOut need adjusting then. I'm using characters as symbols :)

Share this post


Link to post
Share on other sites

This topic is 3601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this