[reportlab-users] Re: ReportLab + Macintosh TTFs

Just van Rossum reportlab-users@reportlab.com
Wed, 3 Jul 2002 10:44:04 +0200


Marius Gedminas wrote:

>          # The following tables are simply copied from the original
>          for tag in ('name', 'OS/2', 'cvt ', 'fpgm', 'prep'):
> -            output.add(tag, self.get_table(tag))
> +            try:
> +                output.add(tag, self.get_table(tag))
> +            except KeyError:
> +                # Apparently some of the tables are optional (cvt, fpgm,
prep).
> +                # The lack of the required ones (name, OS/2) would have
already
> +                # been caught before.
> +                pass

Aren't you supposed to copy anything you don't know about? Maybe not true when
embedding TTF in PDF, I'm just guessing.

Btw: in general, the OS/2 table is only required on Windows. Don't know about
when embedding in PDF.

> A couple of related formats are OpenType fonts with PostScript shapes
> (probably they'd need to be converted to Type1 before embedding) and

Those PostScript outlines are stored in the "CFF " table. CFF is a font format
by itself and can be *directly* embedded in PDF (it's actually one of the
reasons for it's existence: it stands for Compact Font Format). Subsetting would
be quite a bit harder than subsetting T1, though. The most efficient way to
embed Type 1 would be to convert it to CFF before embedding, and I think that's
exactly what Distiller does.

> font collections.  Check the first 4 bytes -- 'OTTO' means it's OpenType
> with PostScript outlines, 0x00010000 means TrueType (= OpenType with
> TTF outlines), 'ttcf' means TrueType Collection.

Apple ships TT fonts which have "true" as the first four bytes...

Just