Debian Codegraph @

doc/sphinx/techref/macformats.rst

raw
1 Macintosh font formats
2 ======================
3
4 The mac stores fonts in resources. It use to store resources in resource forks
5 (which have no representation on unix) but now (Mac OS/X) it also stores them in
6 data forks.
7
8 Apple (and Adobe) provide some documentation on the mac's formats:
9
10 * `Mac Resource Fork <https://developer.apple.com/legacy/library/documentation/mac/MoreToolbox/MoreToolbox-9.html>`__
11 * Mac
12 `NFNT/FONT <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-250.html>`__
13 resource
14 * Mac
15 `FOND <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-269.html>`__
16 resource
17 * Mac
18 `sfnt <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-253.html>`__
19 resource
20
21 * This is basically a
22 `truetype <https://developer.apple.com/fonts/TrueType-Reference-Manual/>`__ font
23 file stuffed into a resource
24 * The POST resource
25
26 * The connection between postscript file and FOND is described in the
27 `Style Mapping Table <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-275.html>`__
28 of the FOND
29 * `Type1 postscript fonts <https://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/T1_SPEC.pdf>`__
30 are described by Adobe
31 * Adobe also describes how they are
32 `wrapped up on the mac. <https://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/0091.Mac_Fond.pdf>`__
33 * `Macintosh scripts <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-354.html>`__
34
35 * `Script codes <https://developer.apple.com/legacy/library/documentation/mac/Text/Text-367.html#HEADING367-0>`__
36 * `Carbon (Mac OS/X) docs <https://developer.apple.com/legacy/library/documentation/Carbon/Conceptual/newtocarbon/Introduction.html>`__
37
38 .. _macformats.dfont:
39
40 I have not yet found a description of a data fork resource file. I have
41 determined empirically that they look almost the same as
42 `resource fork resource files <https://developer.apple.com/legacy/library/documentation/mac/MoreToolbox/MoreToolbox-9.html>`__
43 except that the map table begins with 16 bytes of zeros rather than a copy of
44 the first 16 bytes of the file. To date I have only seen sfnt (and FOND)
45 resources in a data fork resource file (often called a .dfont file).
46
47 FontForge does not support the old 'fbit' font format for CJK encodings (but
48 then neither does the Mac any more so that's probably not an issue).
49
50 When an 'sfnt' resource contains a font with a multibyte encoding (CJK or
51 unicode) then the 'FOND' does not have entries for all the characters. The
52 'sfnt' will (always?) have a MacRoman encoding as well as the multibyte encoding
53 and the 'FOND' will contain information on just that subset of the font. (I have
54 determined this empirically, I have seen no documentation on the subject)
55
56 Currently bitmap fonts for multibyte encodings are stored inside an sfnt
57 (truetype) resource in the 'bloc' and 'bdat' tables. When this happens there are
58 a series of dummy 'NFNT' resources in the resource file, one for each strike.
59 Each resource is 26 bytes long (which means they contain the FontRec structure
60 but no data tables) and are flagged by having rowWords set to 0. (I have
61 determined this empirically, I have seen no documentation on the subject)
62
63 When a 'sfnt' resource contains only bitmaps (and no glyph outlines) it is
64 sometimes called an 'sbit'.
65
66
67 Resource forks on Mac OS/X
68 --------------------------
69
70 The unix filename for the resource fork of the file "foo" is "foo/rsrc". (I was
71 told this and it appears to be correct, I have seen no documentation on the
72 subject)