freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug report: Allow CFF based OT fonts with missing map table


From: Derek B. Noonburg
Subject: Re: Bug report: Allow CFF based OT fonts with missing map table
Date: Wed, 5 Jun 2024 12:07:07 -0700

On Wed, 5 Jun 2024 18:16:26 +0200
"Adam Twardoch (List)" <list.adam@twardoch.com> wrote:

> I wouldn’t call such a font (just `CFF ` table in an SFNT wrapper) an
> OpenType font (nor a TrueType font, nor an ISO OFF font).

I completely agree. Just to clarify, when I said "It looks like some
software (my sample files are ~10 years old) decided to wrap a CFF font
into an sfnt structure, with the single 'CFF ' table, and call it an
OpenType font", that was a snarky complaint about the quality of said
software.

> But the SFNT
> wrapper can host various sorts of tables, including many that aren’t
> part of the OpenType or ISO spec (like the `typ1` table used years
> ago by Apple). I think all kinds of table assortments can be put in
> an SFNT-based font resource, and there’s nothing invalid about such a
> resources — except that that resource isn’t a TT or OT or OFF font.
> 
> The question is whether FreeType wants to gracefully deal with
> SFNT-based font resources that aren’t TT or OT or OFF fonts.

My own focus is on PDF files. The PDF spec says that fonts declared as
OpenType should be OpenType, and the files I'm looking at violate the
spec. (PDF also supports standalone CFF fonts, so it's relatively
little extra work for me to pull the CFF blob out of these bogus
"OpenType" fonts, and handle it as a CFF font.)

I commented on this thread mostly because I'm curious to know if anyone
else has encountered PDF fonts that claim to be OpenType, but are
missing other tables. To be specific: Xpdf currently looks for the
'head' table; if that's present it assumes the font is valid OpenType
and hands it to FreeType as-is. If the head table is missing, it
triggers the other path I mentioned of extracting the CFF blob. If
someone were to embed a declared-as-OpenType font with head and CFF
tables, but no cmap, then I think my code would fail (because FreeType
would reject the font as invalid) -- but I have yet to encounter such a
font.

- Derek



reply via email to

[Prev in Thread] Current Thread [Next in Thread]