POW -- Bug 274


Subject: POW -- Bug 274
From: Eric W. Sink (eric@sourcegear.com)
Date: Wed May 03 2000 - 11:29:21 CDT


The goal of this POW is to fix bug 274, which is a Windows-specific
problem with page positioning for printers. This bug has vexed me for
a very long time. It should not be terribly difficult to fix, so it
may be a good way for a Windows programmer to become a new contributor
to the project.

scope
-----

The bug is definitely specific to Windows, and should require no API
changes or anything else which would affect behavior on other
platforms. We think the core of the problem is that our printing code
is not properly accounting for the printable area of the page, as
reported by the printer driver.

hints
-----

To tackle this bug, you should look at the following things:

1. In ap/src/wp/ap/xp/ap_EditMethods.cpp, s_doPrint(). This is the
    function which controls printing in response to a command from the
    user.

2. Check out
    abi/src/af/xap/win/XAP_Win32Dialog_Print::getPrinterGraphicsContext(void).
    This function constructs a graphics context for the current
    printer.

3. In abi/src/af/gr/win, see startPrint() and startPage(). This
    entire file is the implementation of Windows graphical drawing
    primitives which are used for both printer and screen.

4. In your Win32 API documentation, checkout GetDeviceCaps() and
    PHYSICALOFFSETX and PHYSICALOFFSETY.

5. Find the plastic six-inch ruler you used during high school
    geometry. :-)

6. The proper fix for this bug is to adjust the coordinate system
    during Windows printing to account for the physical printable area
    of the page.

7. Done properly, this bug fix should not affect other platforms, and
    should not affect the operation of the Windows version when
    drawing to the screen.

8. Print a document which has a one inch left margin. Measure the
    distance from the left edge of the page to the beginning of
    printed text. It should be one inch.

9. As always, the abiword-dev mailing list is your primary resource.
    If you get stuck, or if you discover that the approach outlined
    here may not be the proper way to fix the problem, let's discuss
    it on the list. :-)

10. As soon as say you are done, Bob is going to print the same
     one-page document on Linux, and then on Windows, and hold the two
     pages up to a light. His office is just close enough to mine
     that I'm sure I'll be able to hear the moaning if the two pages
     don't look the same. :-)

Enjoy!

Eric

PS: For more background on the POW / ZAP / SHAZAM concept, see the
following introduction:

  http://www.abisource.com/mailinglists/abiword-dev/99/September/0097.html

-- 
Eric W. Sink, Software Craftsman
SourceGear Corporation
eric@sourcegear.com



This archive was generated by hypermail 2b25 : Wed May 03 2000 - 11:29:22 CDT