[Pythonmac-SIG] font file resources

Nicholas Riley njriley at uiuc.edu
Tue Dec 16 14:02:14 EST 2003


On Tue, Dec 16, 2003 at 06:22:21PM +0000, Robin Becker wrote:
> A darwin client wishes to pass a TTF file from an embedding application
> into our python extension. I have made an interface which allows for us
> to copy the memory image if it is presented correctly. He mentioned that
> he thinks he will actually get a pointer to something called a resource
> fork that contains the font. If that is the case can I detect this case
> from the memory and do the copy from the right place etc?

Try using fondu to convert to TTF from a Mac-format resource-fork
TrueType font:

	<http://fondu.sourceforge.net/>

It's not perfect but it does a reasonably good job.  Resource forks
are structured binary data and typically accessed by the Mac Resource
Manager APIs; while it would be possible (and it's been done many
times before) to parse the resource data directly, it's likely not
worth your time.  Of course if you're running on a Mac, there are lots
of Python modules to make your life easier when dealing with
resources.

The author of fondu also wrote PfaEdit, which has a scriptable mode
that can be used if the font is one fondu can't handle.

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>



More information about the Pythonmac-SIG mailing list