OpenType Collections—Redux

As described in last month’s article, our tools engineer developed two Python scripts for assembling and disassembling ‘sfnt’ collections, both of which operate on TrueType-based source fonts to produce a traditional TrueType Collection (TTC) font or to break apart one, but also operate on CFF-based source fonts to produce a new font species known as an OpenType Collection (OTC).

The purpose of this follow up article is to convey the news that these scripts have been tweaked slightly, and have been included in a new version of AFDKO that was released on 2014-02-18 as Build 61250. One of the benefits of the integration with AFDKO is that the tools are now easier to run, as a simple command.

The following is a demonstration:

% otf2otc -t 'cmap'=0 -o LogoLineStd.ttc LogoLineStd-Light.otf LogoLineStd-Medium.otf LogoLineStd-Bold.otf LogoLineStd-Ultra.otf
Input fonts: ['LogoLineStd-Light.otf', 'LogoLineStd-Medium.otf', 'LogoLineStd-Bold.otf', 'LogoLineStd-Ultra.otf']
Output font: LogoLineStd.ttc
Shared tables: ['GSUB', 'cmap', 'maxp', 'post', 'vhea']
Un-shared tables: ['BASE', 'CFF ', 'GPOS', 'OS/2', 'VORG', 'head', 'hhea', 'hmtx', 'name', 'vmtx']
Done

(Note: The version of this script in AFDKO Build 61250 transposes the reporting of the shared and unshared tables, and what is shown above is based on a corrected version that can be downloaded here, then installed into the “Tools/SharedData/FDKScripts/” subdirectory of AFDKO, replacing the version that is included in Build 61250.)

Note how its output makes the table-share-check.pl script that I introduced in the previous article somewhat obsolete, by conveniently reporting the (completely) shared and unshared tables. However, that script is not completely useless, because it still reports (completely) shared and unshared tables based on either otc2otf -r and spot -T output, though I suggest downloading the latest version. Below is a demonstration:

% otc2otf -r LogoLineStd.ttc | table-share-check.pl
Shared Tables: GSUB, cmap, maxp, post, vhea
Unshared Tables: BASE, CFF , GPOS, OS/2, VORG, head, hhea, hmtx, name, vmtx

% spot -T LogoLineStd.ttc | table-share-check.pl
Shared Tables: GSUB, cmap, maxp, post, vhea
Unshared Tables: BASE, CFF , GPOS, OS/2, VORG, head, hhea, hmtx, name, vmtx

The above paragraph brings up the last point for this article, which are two behavior changes in the otc2otf script. First, the script supports a new “-r” command-line option that reports table offsets, checksums, and lengths, and the extent to which they are shared on a per-font instance basis, as exemplified below:

% otc2otf -r LogoLineStd.ttc
Input font: LogoLineStd.ttc
font 0 offset: 28/0x0000001C. LogoLineStd-Light.otf
    BASE offset: 0x0000040C, checksum: 0x1BA818DF, length: 0x000000E8
    CFF  offset: 0x000005D8, checksum: 0x1715F501, length: 0x00007D10
    GPOS offset: 0x00020602, checksum: 0x1646F381, length: 0x000009FE
    GSUB offset: 0x00022C14, checksum: 0x9B0A9A80, length: 0x00000926
    OS/2 offset: 0x0002353A, checksum: 0x7529D1A9, length: 0x00000060
    VORG offset: 0x000236BA, checksum: 0x0D0B3CF9, length: 0x00000050
    cmap offset: 0x000237FA, checksum: 0xA1E5EC81, length: 0x00000D88
    head offset: 0x00024582, checksum: 0xFC3D0459, length: 0x00000036
    hhea offset: 0x00024624, checksum: 0x0B4203A3, length: 0x00000024
    hmtx offset: 0x00024690, checksum: 0xC1D77DDB, length: 0x0000039C
    maxp offset: 0x00025500, checksum: 0x01A15000, length: 0x00000006
    name offset: 0x00025506, checksum: 0xE1EDF545, length: 0x00000797
    post offset: 0x00027350, checksum: 0xFFB80032, length: 0x00000020
    vhea offset: 0x00027370, checksum: 0x09C7136C, length: 0x00000024
    vmtx offset: 0x00027394, checksum: 0xC3E2E642, length: 0x00000632
font 1 offset: 280/0x00000118. LogoLineStd-Medium.otf
    BASE offset: 0x000004F4, checksum: 0x1B8E18D8, length: 0x000000E4
    CFF  offset: 0x000082E8, checksum: 0xC61D636F, length: 0x000080F7
    GPOS offset: 0x00021000, checksum: 0xF654DD9C, length: 0x000009AE
    GSUB offset: 0x00022C14, already seen
    OS/2 offset: 0x0002359A, checksum: 0x75F1D5A9, length: 0x00000060
    VORG offset: 0x0002370A, checksum: 0x0D0B3D27, length: 0x00000050
    cmap offset: 0x000237FA, already seen
    head offset: 0x00024582, already seen
    hhea offset: 0x00024624, already seen
    hmtx offset: 0x00024A2C, checksum: 0xBCAA7581, length: 0x0000039C
    maxp offset: 0x00025500, already seen
    name offset: 0x00025C9D, checksum: 0xDB4FBB0C, length: 0x0000079E
    post offset: 0x00027350, already seen
    vhea offset: 0x00027370, already seen
    vmtx offset: 0x000279C6, checksum: 0xC2BDD81E, length: 0x00000632
font 2 offset: 532/0x00000214. LogoLineStd-Bold.otf
    BASE offset: 0x000004F4, already seen
    CFF  offset: 0x000103DF, checksum: 0x31BA2CEC, length: 0x000080E4
    GPOS offset: 0x000219AE, checksum: 0xC9E3B98B, length: 0x00000922
    GSUB offset: 0x00022C14, already seen
    OS/2 offset: 0x000235FA, checksum: 0x76B9D7C9, length: 0x00000060
    VORG offset: 0x0002375A, checksum: 0x0D0B3D17, length: 0x00000050
    cmap offset: 0x000237FA, already seen
    head offset: 0x000245B8, checksum: 0xFC43045B, length: 0x00000036
    hhea offset: 0x00024648, checksum: 0x0B4703A2, length: 0x00000024
    hmtx offset: 0x00024DC8, checksum: 0xAEC76614, length: 0x0000039C
    maxp offset: 0x00025500, already seen
    name offset: 0x0002643B, checksum: 0x959E0945, length: 0x00000787
    post offset: 0x00027350, already seen
    vhea offset: 0x00027370, already seen
    vmtx offset: 0x00027FF8, checksum: 0xC14AC4BE, length: 0x00000632
font 3 offset: 784/0x00000310. LogoLineStd-Ultra.otf
    BASE offset: 0x000004F4, already seen
    CFF  offset: 0x000184C3, checksum: 0xA164D643, length: 0x0000813F
    GPOS offset: 0x000222D0, checksum: 0xD5BEBF8B, length: 0x00000944
    GSUB offset: 0x00022C14, already seen
    OS/2 offset: 0x0002365A, checksum: 0x7781D8C9, length: 0x00000060
    VORG offset: 0x000237AA, checksum: 0x0D0A3D12, length: 0x00000050
    cmap offset: 0x000237FA, already seen
    head offset: 0x000245EE, checksum: 0xFC3D045B, length: 0x00000036
    hhea offset: 0x0002466C, checksum: 0x0B4103A2, length: 0x00000024
    hmtx offset: 0x00025164, checksum: 0xAA6F5FBD, length: 0x0000039C
    maxp offset: 0x00025500, already seen
    name offset: 0x00026BC2, checksum: 0x01BFFDAC, length: 0x0000078E
    post offset: 0x00027350, already seen
    vhea offset: 0x00027370, already seen
    vmtx offset: 0x0002862A, checksum: 0xC039BB2B, length: 0x00000632
Done

Second, this script now reports which fonts are created when breaking apart an ‘sfnt’ collection (the “-w” command-line option as described in the previous article is no longer necessary, and is thus no longer supported):

% otc2otf LogoLineStd.ttc
Input font: LogoLineStd.ttc
Output font: LogoLineStd-Light.otf
Output font: LogoLineStd-Medium.otf
Output font: LogoLineStd-Bold.otf
Output font: LogoLineStd-Ultra.otf
Done

As usual, enjoy!

Comments are closed.