[Pythonmac-SIG] font file resources

Jack Jansen Jack.Jansen at cwi.nl
Tue Dec 16 15:47:05 EST 2003


On 16-dec-03, at 20:02, Nicholas Riley wrote:

> 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.

Robin,
in addition, to access resource data have a look at the Carbon.Res 
module.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list