Dylan Smith wrote:
You accidentally sent the email for try 2 of this patch to wine-devel instead of wine-patches.
In function ME_FormatContent in file paint.c you calculate the value
- numCharPrintable = c.nAvailWidth / (1440/c.dpiTarget.cy);
then use it later to set iEndOffset, the return value, when the remainder of the text doesn't fit the page.
- if (iEndOffset == -1)
- {
- iEndOffset = numCharPrintable + 1;
- targetBottom = c.pt.y - cyOffset;
- }
The problem is that numCharPrintable is the width of the page in twips but the return value is supposed to be "the index of the last character that fits in the region, plus 1." So the return value isn't some value in twips, it should be a character index reflecting the page boundary.
As I have mentioned to you before in an offlist email, this will cause problems with applications which try to print all the pages in a loop with cpMax=-1 to specify to print to the end of the text, and cpMin for following calls set to the return value of preview calls to send EM_FORMATRANGE messages. The return value will cause an endless loop for long enough text with more characters than the width of the page in twips.
Interesting comment here, the long text file that you send me does display properly on my system.
I will try with a longer file that caused a major looping problem: A hints file for Quake4 that is about 100 pages long and uses exactly that method to display. The problem may be in the original code's limit on the number of font changes before the code attempts to 'back out' and start over.
James McKenzie