Formatting text onto a DC
-
This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC. The issue is printing text onto a DC. Should be simple enough, but here are some constraints: 1. The text may be rotated 0, 90, 180, 270 degrees. 2. The text may need reformatted within the bounding rectangle, meaning word-breaks. 3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically. Rotating text is not a problem. Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap. Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit? Or can someone please point me to some code that will accomplish this easily? Thank you for your time
-
This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC. The issue is printing text onto a DC. Should be simple enough, but here are some constraints: 1. The text may be rotated 0, 90, 180, 270 degrees. 2. The text may need reformatted within the bounding rectangle, meaning word-breaks. 3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically. Rotating text is not a problem. Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap. Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit? Or can someone please point me to some code that will accomplish this easily? Thank you for your time
It might be Q&D, but what about drawing the text onto an in-memory bitmap/surface and then rotating it, and then blitting it to the target bitmap/surface? Other than that, maybe the GDI+ libraries have something to offer? Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
It might be Q&D, but what about drawing the text onto an in-memory bitmap/surface and then rotating it, and then blitting it to the target bitmap/surface? Other than that, maybe the GDI+ libraries have something to offer? Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFilesUnfortunately, I am out of options at this point... In-Memory bitmap and rotate would have to be the answer. I was kind of hoping some built-in API.
-
This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC. The issue is printing text onto a DC. Should be simple enough, but here are some constraints: 1. The text may be rotated 0, 90, 180, 270 degrees. 2. The text may need reformatted within the bounding rectangle, meaning word-breaks. 3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically. Rotating text is not a problem. Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap. Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit? Or can someone please point me to some code that will accomplish this easily? Thank you for your time
Stephen, I am not familiar with the World Transform functions, so I will have to go through the sections to pick up on them, but thank you for pointing me at them. From the initial look I had, they do look promising. Santanu
-
This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC. The issue is printing text onto a DC. Should be simple enough, but here are some constraints: 1. The text may be rotated 0, 90, 180, 270 degrees. 2. The text may need reformatted within the bounding rectangle, meaning word-breaks. 3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically. Rotating text is not a problem. Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap. Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit? Or can someone please point me to some code that will accomplish this easily? Thank you for your time
Stephen, Your suggestion was exactly what I needed. I used the SetWorldTransform API to rotate and align text along the required axes and let DrawText do the wordwrap part. Thank you very much.