15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


TabbedTextOut(): What am I doing wrong?

Mike Erickson -- mpericks@gnn.com
Thursday, August 08, 1996

Environment: VC 1.52 WfW 3.11

In my doc I load a CStringList with strings preceded by a number of 
"\t" tabs to indent appropriately and attempt to draw the text to 
the printer DC in my view in OnPrint() like this

	C84inchDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CFont* pOldFont = pDC->SelectObject(&m_font);//12 pt Times N R
	int lineheight = GetCharHeight(pDC);//returns tmHeight +
                                             tmExternalLeading
	
	CString str;
	for( POSITION pos = 
          pDoc->m_output.GetHeadPosition(); pos != NULL; )
	{
		str =  pDoc->m_output.GetNext(pos);
		pDC->TabbedTextOut(0, m_nPos,
					   str,str.GetLength(),0,NULL,0);
		m_nPos -= lineheight;
	}
	
	m_nPos = 0;
	pDC->SelectObject(pOldFont);


Mapping mode is LOENGLISH.  This works great for all the printers I 
tried it on in Print Preview, but while actually printing on a few 
printers it clips off a seemingly random portion of each text line.  
It works on all the laser printers I tried, doesn't work on an ENCAD 
plotter or a Panasonic dot matrix.  Both clip the text in the same 
way.  If I take out the \t in the strings, everything is cool.  I 
tried passing a tab position array with same results.  This must be 
something really embarassing and stupid, so be gentle.



Mike Erickson
The Torrington Co.
mpericks@gnn.com
erickm@torrington.com




ppbillc@srv2.sj.ablecom.net
Monday, August 12, 1996


> Environment: VC 1.52 WfW 3.11
> 
> In my doc I load a CStringList with strings preceded by a number of 
> "\t" tabs to indent appropriately and attempt to draw the text to 
> the printer DC in my view in OnPrint() like this
> 
> 	C84inchDoc* pDoc = GetDocument();
> 	ASSERT_VALID(pDoc);
> 	CFont* pOldFont = pDC->SelectObject(&m_font);//12 pt Times N R
> 	int lineheight = GetCharHeight(pDC);//returns tmHeight +
>                                              tmExternalLeading
> 	
> 	CString str;
> 	for( POSITION pos = 
>           pDoc->m_output.GetHeadPosition(); pos != NULL; )
> 	{
> 		str =  pDoc->m_output.GetNext(pos);
> 		pDC->TabbedTextOut(0, m_nPos,
> 					   str,str.GetLength(),0,NULL,0);
> 		m_nPos -= lineheight;
> 	}
> 	
> 	m_nPos = 0;
> 	pDC->SelectObject(pOldFont);
> 
> 
> Mapping mode is LOENGLISH.  This works great for all the printers I 
> tried it on in Print Preview, but while actually printing on a few 
> printers it clips off a seemingly random portion of each text line.  
> It works on all the laser printers I tried, doesn't work on an ENCAD 
> plotter or a Panasonic dot matrix.  Both clip the text in the same 
> way.  If I take out the \t in the strings, everything is cool.  I 
> tried passing a tab position array with same results.  This must be 
> something really embarassing and stupid, so be gentle.
> 

MIke,

         Try a system font see if the same thing happens. If not you 
logfont need to be zerod out.

Bill


 

 




| Вернуться в корень Архива |