Read Font Suitcase File

Hi!

I’m trying to open and read any font suitcase file on mac.
(or even truetype font file, or postscript font file)

I can’t read it neither on terminal, textedit, textwrangler, neither on xojo!

why? the file has contents, because it’s grater than “0 kB” and it’s readable from within Font Book.app and other “font readers” apps.

Any guess?

Thanks in advance.

Alex

My guess is that it is a resource fork based font.

Resource forks are from the macOS Classic (pre MacOS X) days. A file could consist of two forks: data fork and resource fork. The data fork is where data would normally be stored while the resource fork would be where resources such as code, menus, icons, fonts etc… would be stored in a structured format.

The reason why those apps aren’t showing anything when opening the file is because they will only be loading the data.

Resource forks were abandoned when MacOS X was released so there isn’t much out there today that works with them.

The MBS plugin has functions to read the resource fork data.

Hi.

Yes i know well about data and resource forks.

How can i access the data fork / resource fork on macos x thru xojo?

The information is there, because the fontbook reads it.

Alex

I have used MBS plugins to do this.

I have read that you can open the resource fork by appending the following to the file path but it’s not something I’ve tried personally.
/…namedfork/rsrc

1 Like

See ResourceForkMBS class in MBS Xojo Plugins.

But if you want to skip parsing fonts yourself, you could let DynaPDF do it and use the DynaPDFMBS class to query infos for that font file.

Hi. i don’t want to use third part plugins. is it possible to do it directly on xojo?

Did you try my suggestion?

I imagine you could also declare into the relevant macOS APIs or maybe check if the macOS API project (can’t remember it’s proper name) can do it.

1 Like

yes, i read. just today i figured out the “full command”

Since Mac OS X 10.7 (released in 2011), the old syntax for accessing resource fork no longer works.
The new syntax is ls -l filename/..namedfork/rsrc

i.e.: ls -lah AacheBol/…namedfork/rsrc

i.e.: pico AacheBol/…namedfork/rsrc

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.