Topic: Problem with type size for the printer

At me the output of the contained text file to the printer is carried out. Here the code: void CPrintSolvedNUDialog:: OnBnClickedOk ()//if there was a pushed button "Press" {//TODO: add the code of the output agent of notification messages int i, n, len, cyChar, cyPage, yPos; char s [256]; CString myString; LPCSTR pzText; LPTSTR lpszText; DWORD size = MAX_PATH; TCHAR temp [MAX_PATH]; TEXTMETRIC txtm; LOGFONT lf; FILE *f; CPrintDialog cp (FALSE); if (cp. DoModal () == IDOK) {CDC printDC; printDC.Attach (cp. GetPrinterDC ()); cyPage = printDC.GetDeviceCaps (VERTRES); printDC.GetTextMetrics (&txtm); cyChar = txtm.tmHeight + txtm.tmExternalLeading; yPos = 0; DOCINFO docinfo;:: ZeroMemory (&docinfo,sizeof (DOCINFO)); docinfo.cbSize = sizeof (docinfo); docinfo.lpszDocName = "Simple"; docinfo.lpszOutput = NULL; docinfo.lpszDatatype = "RAW"; docinfo.fwType = 0; CFont *savedFont; savedFont = printDC.GetCurrentFont (); savedFont-> GetLogFont (&lf); strcpy (lf.lfFaceName, "Courier New"); lf.lfHeight = 60;//60 instead of 10 lf.lfWidth = 48;//48 instead of 8 CFont myFont; myFont. CreateFontIndirectA (&lf); printDC.SelectObject (&myFont); if (printDC.StartDoc (&docinfo)> 0) {if (printDC.StartPage ()> 0) {f = fopen ("results.txt", "rt"); while (! feof (f)) {fgets (s, 256, f); len = strlen (s); pzText = (LPCSTR) s; printDC.TextOutA (0, yPos, pzText, len); yPos + = cyChar;} fclose (f); printDC.EndPage ();} printDC.EndDoc ();} printDC.SelectObject (savedFont); printDC.Detach ();} CDialogEx:: OnOK ();} The press on the printer goes, is printed in the size necessary to me. But there is one question - for instructions of type sizes (Courier New) I set the sizes 60 in height and 48 at width, instead of accordingly 10 and 8. Because when I set type sizes 10 x 8, at me letters were displayed very small - somewhere millimeter in height. In what of the reason of it? I work under Window 7, development environment MS a Visual Studio 2012, printer HP LAserJet M1522n. If the program to transfer on other machine, with other Windows version (for example, Windows XP) and with other printer the size of the deduced text on the printer will be same, as well as at me, or it, generally speaking, will be another? How to make so that text a file at me it was printed on different printers with the identical size?


Re: Problem with type size for the printer

P.S. Font Courier New - .


Re: Problem with type size for the printer

Hello, RussianFellow, you wrote: RF> How to make so that text a file at me it was printed on different printers with the identical size? SetMapMode it can is necessary to install any in logical ones, at different printers different resolutions, therefore if to deduce in pixels result clear business will be a miscellaneous. Look in source codes MFC as there at them printing it is organized