win32ui.CreateFont() question

C

Chris Gonnerman

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.GetDeviceCaps(LOGPIXELSY) / 72.0
return win32ui.CreateFont({
"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.CreateFont() 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 -- (e-mail address removed)
http://newcenturycomputers.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,927
Members
47,469
Latest member
benny001

Latest Threads

Top