win32ui.CreateFont() question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Gonnerman

    win32ui.CreateFont() question

    I am rewriting an antique BASIC program in Python for a
    customer. The main feature of the program is printing a
    work order for a particular assembly; the BASIC program
    uses IBM OEM line-drawing characters.

    The new program must reproduce the work order as closely as
    possible but be able to print to brainless inkjet printers.
    I found the MS Linedraw font online, and am able to print
    the line-drawing characters with it under Windows XP but
    the same code fails to work in Windows 98, printing
    international characters instead.

    I'm not sure what code to post from the application (the
    printing code is a bit long to post), but if nobody has
    an easy answer I'll see what I can boil down.

    I'm calling CreateFont using this function:

    LOGPIXELSY = 90

    def getfont(dc, name, size):
    scaley = dc.GetDeviceCap s(LOGPIXELSY) / 72.0
    return win32ui.CreateF ont({
    "name": name,
    "height": int(1.0 * scaley * size),
    })

    If there is a better/more correct way I'd be happy to
    see it.

    Also: How do you know what font Windows actually chose?
    The PyCFont returned by win32ui.CreateF ont() does not have
    any properties or methods as far as I can tell, so no way
    to access the underlying MFC CFont object.

    Chris Gonnerman -- chris.gonnerman @newcenturycomp uters.net



Working...