rem: lpText->CharCount -= num_chars; num_chars = 0;
add: next_ch = getCharFromString (&pStr); if (next_ch == '\0') { lpText->CharCount -= num_chars; num_chars = 0; }
context: TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta){	FONTPTR FontPtr;	FontPtr = _CurFontPtr;	if (FontPtr != 0 && lpText->CharCount != 0)	{		COORD top_y, bot_y;		SIZE width;		wchar_t next_ch;		const unsigned char *pStr;		COUNT num_chars;			num_chars = lpText->CharCount;		/* At this point lpText->CharCount contains the *maximum* number of		 * characters that lpText->pStr may contain.		 * After the while loop below, it will contain the actual number.		 */		if (pdelta == 0)		{			pdelta = char_delta_array;			if (num_chars > MAX_DELTAS)			{				num_chars = MAX_DELTAS;				lpText->CharCount = MAX_DELTAS;			}		}		top_y = 0;		bot_y = 0;		width = 0;		pStr = lpText->pStr;		next_ch = getCharFromString (&pStr);		if (next_ch == '\0')			num_chars = 0;		while (num_chars--)		{			wchar_t ch;			SIZE last_width;			FRAME_DESC *charFrame;			last_width = width;			ch = next_ch;			next_ch = getCharFromString (&pStr);			if (next_ch == '\0')			{				lpText->CharCount -= num_chars;				num_chars = 0;			}			charFrame = getCharFrame (FontPtr, ch);			if (charFrame != NULL && GetFrameWidth (charFrame))			{				COORD y;				y = -charFrame->HotSpot.y;				if (y < top_y)					top_y = y;				y += GetFrameHeight (charFrame);				if (y > bot_y)					bot_y = y;				width += GetFrameWidth (charFrame);#if 0				if (num_chars && next_ch < (UNICODE) MAX_CHARS						&& !(FontPtr->KernTab[ch]						& (FontPtr->KernTab[next_ch] >> 2)))					width -= FontPtr->KernAmount;#endif			}			*pdelta++ = (BYTE)(width - last_width);		}		if (width > 0 && (bot_y -= top_y) > 0)		{			/* subtract off default character spacing */			--pdelta[-1];			--width;			if (lpText->align == ALIGN_LEFT)				pRect->corner.x = 0;			else if (lpText->align == ALIGN_CENTER)				pRect->corner.x = -(width >> 1);			else				pRect->corner.x = -width;			pRect->corner.y = top_y;			pRect->extent.width = width;			pRect->extent.height = bot_y;			pRect->corner.x += lpText->baseline.x;			pRect->corner.y += lpText->baseline.y;			return (TRUE);		}	}	pRect->corner = lpText->baseline;	pRect->extent.width = 0;	pRect->extent.height = 0;	return (FALSE);}