Printing vertical text (or not!)

Hi, I've got another printing question.  I need to print some vertical
text on a printout (entire line of text rotated 90 degrees, not just
horizontal letters stacked vertically).  I set nEscapement and
nOrientation to 900 in my CFont, and the font is rotated correctly,
but I can't figure out how to place it on the page.  Using DrawText()
with DT_CENTER and DT_VCENTER doesn't work - the text prints, but not
centered.  I also see that if I do a DrawText() with DT_CALCRECT, the
resulting rectangle does not correspond to the text if it were printed
vertically.  That is, it will return with a rectangle that is maybe
100 high and 500 wide, whereas for vertical text I would expect a
rectangle 500 high and 100 wide.

I could calculate all the offsets myself after getting the DT_CALCRECT
result, and then use TextOut(), but I don't know if that will work if
my printer X and Y resolutions are not the same.  That is, is the
rectangle returned with DT_CALCRECT really the size of the rotated
rectangle, with the rectangle height being the number of pixels in the
X direction, and the width being the number of pixels in the Y
direction?  Does the returned rectangle properly account for different
X and Y resolutions, or is it giving me the rectangle for the text
oriented horizontally, which would not be correct if the X and Y
resolutions are different?  If the returned rectangle does deal
correctly with the X and Y resolutions, then my calculations would
work for different X and Y resolutions, but if not then they
wouldn't.  And I don't have a printer with different resolutions at
hand to test it.

That's confusing so I'll put some numbers on it.  Suppose I have a
printer with X resolution of 100dpi and Y resolution of 200dpi, and I
have some text that is 2 inches long and 1/4 inch high.  With
horizontal orientation my text rectangle should be 200 pixels wide and
50 pixels high, but with vertical orientation my rectangle should be
25 pixels "high" (in the X direction) and 400 pixels "wide" (in the Y
direction).  But I don't know if the rectangle returned via
DT_CALCRECT gets that right.

So, to summarize, I can't figure out how to properly place text that
is rotated 90 degrees, and I'd really appreciate a bit of help in the
matter.  Thanks.

Mike

0
8/21/2007 3:50:30 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
514 Views

Similar Articles

[PageSpeed] 37

DrawText does not work for rotated text.  From the DrawText documentation:

"The DrawText function supports only fonts whose escapement and orientation are both zero"

Use TextOut and compute the offsets for x,y  yourself.  All the details you've given about
"numbers" don't matter, because the API is explicitly documented as not working with
rotated text.

Also, I have a memory that DrawText does not work well on printers.  So I've largely
avoided it.
					joe


On Tue, 21 Aug 2007 08:50:30 -0700, Mike Silva <snarflemike@yahoo.com> wrote:

>Hi, I've got another printing question.  I need to print some vertical
>text on a printout (entire line of text rotated 90 degrees, not just
>horizontal letters stacked vertically).  I set nEscapement and
>nOrientation to 900 in my CFont, and the font is rotated correctly,
>but I can't figure out how to place it on the page.  Using DrawText()
>with DT_CENTER and DT_VCENTER doesn't work - the text prints, but not
>centered.  I also see that if I do a DrawText() with DT_CALCRECT, the
>resulting rectangle does not correspond to the text if it were printed
>vertically.  That is, it will return with a rectangle that is maybe
>100 high and 500 wide, whereas for vertical text I would expect a
>rectangle 500 high and 100 wide.
>
>I could calculate all the offsets myself after getting the DT_CALCRECT
>result, and then use TextOut(), but I don't know if that will work if
>my printer X and Y resolutions are not the same.  That is, is the
>rectangle returned with DT_CALCRECT really the size of the rotated
>rectangle, with the rectangle height being the number of pixels in the
>X direction, and the width being the number of pixels in the Y
>direction?  Does the returned rectangle properly account for different
>X and Y resolutions, or is it giving me the rectangle for the text
>oriented horizontally, which would not be correct if the X and Y
>resolutions are different?  If the returned rectangle does deal
>correctly with the X and Y resolutions, then my calculations would
>work for different X and Y resolutions, but if not then they
>wouldn't.  And I don't have a printer with different resolutions at
>hand to test it.
>
>That's confusing so I'll put some numbers on it.  Suppose I have a
>printer with X resolution of 100dpi and Y resolution of 200dpi, and I
>have some text that is 2 inches long and 1/4 inch high.  With
>horizontal orientation my text rectangle should be 200 pixels wide and
>50 pixels high, but with vertical orientation my rectangle should be
>25 pixels "high" (in the X direction) and 400 pixels "wide" (in the Y
>direction).  But I don't know if the rectangle returned via
>DT_CALCRECT gets that right.
>
>So, to summarize, I can't figure out how to properly place text that
>is rotated 90 degrees, and I'd really appreciate a bit of help in the
>matter.  Thanks.
>
>Mike
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/21/2007 8:20:26 PM
Reply:

Similar Artilces:

I cannot get my printer to print any information
I USED EXCEL 2003 TO GENERATE A WORKSHEET WITH DATA. I CANNOT PRINT IT. WHY? The why could be many things, some of which could be exel issues and some of which could be driver issues, network issues, or others. Can you, for instance, print from other applications to your printer? Have you been able to print from Excel in the past and this is a new problem, or is this your first attempt to print from Excel? -- Y "ANDIAMO" wrote: > I USED EXCEL 2003 TO GENERATE A WORKSHEET WITH DATA. I CANNOT PRINT IT. WHY? ...

Changing vertical axis in chart in Excel
I have created a chart in exel that is supposed to represent monthly sales throughout the year in various categories. The vertical axis, which i need to reflect dollar amounts only reflect percentages. The months and the categories are correct. How can I change that vertical axis to match the financial data in my worksheet. I have the months in row A, and I have the categories in column 1. The financial data is in the corresponding cells. I'm running Office 2OO7. ...

How do I print one image (say page 1) twice on the same page?
Hello, does anyone know if Excel offer the print option of printing 2up? Meaning, printing the same page twice on one sheet (ie: page 1 printed twice -perhaps landscape, side-by-side, and 50% of course. I have tried and I do not know if Excel is capable of this. Any assistance is appreciated. Hi there I had exactly the same question a few months ago. The simple answer is Excel can't do this easily. So a workaround is required. What I did for my workbook was to add an extra worksheet on which I copied what I wanted to print. I called the worksheet "Double". The worksheet ha...

Text Field
I have created a database using linked tables. There are no notes fields in those tables and I need one. I created a text field and entered a comment but that comment appears against every record but I want it to stay within the record it was recorded against. Anyone help ? Hi KC Where did you create the text field? Since the table is linked, you need to create the text field in your data source, where ever the tables actually reside. If you created the text field (box) on a form, it will not be bound to a particular record and thus it will show up for all of the records, similar to ...

Is there a way to automatically resize a text box to the font size
I know how to set the font to automatically resize to the text box, but is there a way to automatically resize the text box to the font size? Very often I have the font size exactly how I want it and I have to adjust the text box so it's as tight to the text as possible. If there isn't an automatic way to do this, this feature should be included in the next version of Publisher. ...

insert text data using function
Hi Guys, I need help on the following matter. Suppose i have two column A and B. Now when i insert some text in the A1 cell i want the data automatically set up in the B1 Cell. Fox example if i type Linux in the A1 cell "Open Source" will be automatically inserted in the B1 cell but if i insert windows "close source" will be inserted autoamtically. I tried with if function but no success. How can i achieve that? Mosaddeq Aziz You need to set up all of your possible data entry values for column A on Sheet2. Then in column B on sheet2, put the values you want aut...

Vertical tabs in Property Sheet
Hi, I'm trying to create a property sheet wherein the tabs would be displayed vertically(on the left), rather than on top. The code is as shown below: BOOL CMyPropSheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); CTabCtrl *pTab = GetTabControl(); pTab->ModifyStyle(0, TCS_VERTICAL ); return bResult; } The problem with this is that the tabs are not displayed clearly. The edges are only vaguely visible till I click on them. Apprecaite if anyone could help me fix this. Also, can icons be displayed on the tabs rather than plain text...

CListCtrl large icons and text problem
Hi, I have a simple thumbnail view control based on CListCtrl and description of each item is a 3-line text. Unfortunately CListCtrl shows only two first lines, and the third one is visible only for selected item. How can I show 3 lines of text for all items ? How can I increase label width ? Thanks in advance, Kamil Karmil, Here is a control that might do what you'd like. Tom http://www.codeguru.com/listview/ReportCtrl.shtml "kamil" <kamildobk@xxxpoczta.onet.pl> wrote in message news:OndTGoS4DHA.3360@tk2msftngp13.phx.gbl... > Hi, > > I have a simple thum...

Text Box in Publisher
I am trying to create a text box in publisher with the measurement of 5.75 (h) x 5 (w). But publisher is making the height 5.751. How do I correct this? Is this even possible. Don't think it is possible... The .001 is so tiny it shouldn't make much difference. I can get a true 5.75 in Publisher 2000 but as soon as I copy/paste it goes back to 5.751 in 2002, 2003 and 07. Lines do the same. I can create a rectangle in a draw program, paste special into Publisher, ungroup, this rectangle will maintain the correct size. -- Mary Sauer http://msauer.mvps.org/ "Nikki" &l...

when i print maximum pages is 99 how do i increase?
I have reports which I print 250 pages of the same item but even though I put in the amount 250 the maximum it prints is 99 so to get what I want I have to do (99, 99, and the 52 to get the 250) and its only recently started doing this - my company upgraded its server. On Fri, 14 Dec 2007 10:17:00 -0800, qwcqualityinspector <qwcqualityinspector@discussions.microsoft.com> wrote: >I have reports which I print 250 pages of the same item but even though I put >in the amount 250 the maximum it prints is 99 so to get what I want I have to >do (99, 99, and the 52 to get the 250)...

Parse(?) data from text file
I have a large text file that has hundresds (or thousands) of compiled questionairres that I want to convert to a more usable format (excel?). Here is what it looks like: ======================== Name: Joe Jones Address: 123 main comment: varies from blank to 20+ lines may have muliple paragraphs others: 8 or 10 other fields =============================== next questionnaire ====================== A couple of details: the separator line of ====s vary in length, the individual questionnaires are not always identical. Some have a couple of extra 'fields'. I envision a separat...

Printing Headers
Correct me if I'm wrong, but in Outlook 97 I used to be able to print an "Unsent" message and it would included the header information and subject line. But now in Outlook 2002 when I go to print a message in Draft form it doesn't print the Header information regardless of whether the message is in Plain Text, RTF or HTML format? Is this true and if so, is there a work-around? ...

how do I convert an imported number to text
I am downloading data from a computer and wish to convert the number to text in an excel format eg: 0 = pump #1there is a series of numbers from 0 to nine and each one represents a different problem or failure of a piece of machinery Have you tried Find and Replace (Ctrl+H) -- Jacob "Lyn" wrote: > I am downloading data from a computer and wish to convert the number to text > in an excel format eg: 0 = pump #1there is a series of numbers from 0 to nine > and each one represents a different problem or failure of a piece of machinery ...

Vertical Gridlines & Data Marker
Firstly, I noticed that a vertical gridlines of the chart are not align with the gridlines of the data tables. I am wondering how it can be aligned. Secondly, I also noticed that a marker is located on the leftside virtical gridlines of X scales. I am also wondering how to place it on the center. Hi Gary, In my version of Excel they are. Try it with a line chart. In Excel 2007 you might have to make an adjustment. We need more info. With a data table the markers are placed between the vertical gridlines, if you don't like that you can remove the data table and then format th...

Publisher Text Box #2
I am looking for guidance on missing text from text boxes. I understand how overflow works, but this is a different problem. I am preparing a trifold pamphlet where it's important that my text fits into each third without overlapping the folds. I have one long text box filling each third. The only text box that displays all contents when printed is the center third. The first few letters of each line in the left third are curtailed at the left margin. The last few letters of each line in the right third are curtailed at the right margin. I have played around with the margins on bot...

Print custom task list with notes
I need to print a project list. I would like to be able to print out an outlook task list with the text I type in the notes area (that white text area in the task tab, not sure of name) beneath the subject. So for instance I want to be able to print all the tasks in a list but between each task I would like the notes relating to that task. I've seen ways of doing this, but they restrict the length of the text it shows, and I would like the text to be multi-lined, as long as possible, and even italicized so it stands out from the subject heading. I know that memo printing does this but I wo...

How to combine text and the value in another cell?
Excel 2007 Lets say in A2 I have a calculated value of 2 in A1 I want it to say The total of XX = 2 This is what I tried: =CONCATENATE(The Total of XX =,A2) Gave me a "value" error what other approach should I try? tia dave Try this: ="The total of xx = "&A2 -- HTH, RD ===================================================== Please keep all correspondence within the Group, so all may benefit! ===================================================== "Dave" <dave@accessdatapros> wrote in message news:20C0AC3C-2CF3-49BC-8837-428F60A42692@microsof...

Publisher to print an elementary school newspaper?
Hi, a friend of mine ask me if its possible for an Office application that help her to make a school newspaper for her elementary school. Her newspaper should be done in legal size paper in landscape layout and in the form of folded booklet but it the size of the types should not be reduced, I mean the format should be like like a normal book but with only 10 or 12 pages. Could we do that in Publisher or Word? Thank you. SF Javier <javier@usa.net> was very recently heard to utter: > Her newspaper should be done in legal size paper in landscape layout > and in the form of...

Print to file: What format?
Hello, When a user checks the "Print to file" radio button in a print dialog, in what format will the file be and how can it be used? Thanks, John To quote an MSDN article: "The Print To File feature can come in handy if the printer on which you ultimately want to print your document isn't attached to your system. For example, you might be sending the final document to a service bureau to be printed on a high-resolution printer. When you use this feature, you can save the file in a special format that contains raw printer data specific to the selected printer. When you s...

Automatic printing of sent messages.
Can Outlook 2000 be set-up to automatically print a message immediately after having hit the "send" button? or Can a "Send and Print" button be set up? I'm probable not the only grunt that has to print a hard copy of all outgoing e-mails to be maintained in a physical file folder. To make matters worse, bosses cc: me so that I can print out and file their messages too. Thanks >-----Original Message----- >Can Outlook 2000 be set-up to automatically print a >message immediately after having hit the "send" button? or >Can a "Send a...

Changing Mail Format to HTML/Plain Text Doesn't "Stick"
I am having trouble with about 30% of the people I send e-mail with attachments to. If I manually force plain text (usually HTML is not an option) by changing the Internet Format property on the e-mail address, the attachments always come through. However, the default property seems to always be to let Outlook decide the best format (which must be RTF and people can't receive). Via Options/Mail Format, I have "Compose in this message format" defaulted to HTML. In Internet Format, I have Outlook Rich Text Options set to "Convert to HTML format". I've tried "Co...

Why does this text automatically update?
I'm editing a newsletter used by former staff members created in Publisher 2003. (I'm using the same program.) There is a text box on each page in the same spot that says "Volume # Issue #." When I edit it on the first page it automatically changes on all the other pages. I don't think it is an object, embedded or linked or otherwise, because the "Edit Objects" option is greyed out. What is it, and how can I edit/replicate it? It's synchronized text. From Publisher's Help File: When you create a publication from a Publisher wizard or by using Publi...

Colours not printing true
Hi, I have just made up a calendar in Publisher 2003 with my own photos, and printed on my new Canon 4300. I have found that a certain range of colours (the oranges) come out very false and of poor quality. I printed out the photo normally and all was well. I have heard that Publisher can cause trouble with colour- is there some fix or update that would correct this? Just because you see a particular color on your screen doesn't mean that your printer will produce that same image. And different printers will print the colors differently. You need to properly calibrate your monit...

Search box for text
I'm looking for a solution for an item search box for an inventory. I have a spreadsheet that I need to find "Name of product" and scroll it up to the bottom of my frozen pane. I've searched the discussions forum and tried several formulas, non have worked for me. In my frozen panes view, I'm looking to have a search box to type an item name in and have excel scroll it up to the bottom of the frozen pane. The item names are in column "D". Any takers????? Thanks, Allan Grates You are not going to be able to do this with formulas since formulas cann...

Plain Text #3
Hi, I recently upgraded Outlook from 2000 to 2003. It now appears I have a problem with message formats in my INBOX. Messages that have been sent to me in Plain Text cannot be read, and for each message I have to manually change the format to HTML before text shows up. No problem with old messages that were sent in HTML or RTF. I don't understand this. Who can help ? tks Maarten ...