This fixes the problem where italic characters were being redrawn incorrectly 
at boundaries. The problem was that we were resetting the fonts, but not the 
colours. This patch adds a sprinkling of m_pG->setColor(m_colorFG) to fix 
this problem. 

[ someone more familiar than me with fp_textRun may want to review this patch 
before committing. But it seems to work fine. ]

--- fp_TextRun.cpp	Fri Mar 22 16:45:59 2002
+++ fp_TextRun.cpp.colourSet	Fri Mar 22 16:31:04 2002
@@ -1545,7 +1545,7 @@
 
 	/*
 	  TODO We should add more possibilities for text placement here.
-	  It shouldn't be too hard.  Just adjust the math a little.  
+	  It shouldn't be too hard.  Just adjust the math a little.
 	  See bug 1297
 	*/
 	
@@ -1697,8 +1697,8 @@
  				ytemp += pT->m_iDescent /* * 3/2 */;
  			}
 
- 			if(pT->m_bIsOverhanging)
- 				pT->_drawFirstChar(pDA->xoff + m_iWidth,ytemp);
+              		if(pT->m_bIsOverhanging)
+		                pT->_drawFirstChar(pDA->xoff + m_iWidth,ytemp);
 		}
 
 		if(pPrev && pPrev->getType() == FPRUN_TEXT)
@@ -1715,12 +1715,14 @@
  			}
 
  			if(pT->m_bIsOverhanging)
- 				pT->_drawLastChar(pDA->xoff,ytemp, pgbCharWidths);
+			        pT->_drawLastChar(pDA->xoff,ytemp, pgbCharWidths);
+		   
 		}
 	}
 
 	// now draw the whole string
-	m_pG->setFont(m_pScreenFont);
+       m_pG->setFont(m_pScreenFont);
+       m_pG->setColor(m_colorFG); // set colour just in case we drew a first/last char with a diff colour
 
 #ifdef BIDI_ENABLED
 	// since we have the visual string in the draw buffer, we just call m_pGr->drawChars()
@@ -2035,8 +2037,10 @@
 	if(!m_iLen)
 		return;
 
-	// have to sent font, since we were called from a run using different font	
-	m_pG->setFont(m_pScreenFont);
+      // have to sent font (and colour!), since we were called from a run using different font	
+      m_pG->setFont(m_pScreenFont);
+      m_pG->setColor(m_colorFG);
+
 #ifdef BIDI_ENABLED
 	FriBidiCharType iVisDirection = getVisDirection();
 
@@ -2067,8 +2071,10 @@
 	if(!m_iLen)
 		return;
 	
-	// have to sent font, since we were called from a run using different font	
-	m_pG->setFont(m_pScreenFont);
+	// have to sent font (and colour!), since we were called from a run using different font	
+       m_pG->setFont(m_pScreenFont);
+       m_pG->setColor(m_colorFG);
+
 #ifdef BIDI_ENABLED
 	if(!s_bBidiOS)
 	{

Reply via email to