Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Are PostScript Type1 seem like CID Keyed fonts supported by PDF? #497

Open
ceztko opened this issue Nov 27, 2024 · 4 comments
Open
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@ceztko
Copy link

ceztko commented Nov 27, 2024

Adobe Technical Note #5014 "Adobe CMap and CIDFont Files Specification" describes a special postscript Type1 seem like font format that is CID keyed (examples of such fonts can be found at this link). The specified document is often mentioned in the PDF specification speaking about CMap format, but at page 328 of ISO 32000-2:2020 it's stated:

NOTE For complete documentation on the architecture and the file formats, see Adobe Technical Note
#5092, CID-Keyed Font Technology Overview, and Adobe Technical Note #5014, Adobe CMap and
CIDFont Files Specification. This subclause describes only the PDF objects that represent these
font programs.

So said, it's unclear to me if this font is supported by the PDF specification at all. In fact such format cannot be used in a /Type1 PDF font (because it's neither a regular Type1 Postscript to be embedded in /FontFile nor a CFF converted Type1 font to be embedded in /FontFile3 with subtype /Type1C). It also cannot be used in a PDF /Type0 composite font because supported formats for descendant fonts are either FreeType/OpenType fonts with a glyf table or CFF based fonts (see Table 124).

At page 328 it's mentioned:

As mentioned earlier, PDF does not support the entire CID - keyed font architecture, which is independent of PDF; CID - keyed fonts may be used in other environments".

I wonder if the specification could be more clear explicitly stating if these fonts are supported or not. As an additional information, these fonts can be opened by FreeType and FT_Get_Font_Format returns CID Type 1.

@ceztko ceztko added the bug Something isn't correct label Nov 27, 2024
@petervwyatt petervwyatt added help wanted Extra attention is needed question Further information is requested and removed bug Something isn't correct labels Nov 28, 2024
@petervwyatt petervwyatt added this to the Font and text related milestone Nov 28, 2024
@petervwyatt
Copy link
Member

@lrosenthol ?

@faceless2
Copy link

For what it's worth I agree with ceztko's assessment - these fonts cannot be used with PDF, for the reasons he listed (it's not a Simple Type1, and it's not a valid subtype for Type0). I'm prety confident we've never seen a PDF that's tried to use one, and that includes all of GovDocs1 and corpora.tika.apache.org.

It's perhaps not clear when skimming just p328 that these fonts definitely cannot be used, but it's going to become very clear the moment anyone tried to implement code to do so for the reasons already outlined. So I don't personally think a spec clarification is required here, although like all clarifications it's not going to do any harm.

@ceztko
Copy link
Author

ceztko commented Dec 2, 2024

So I don't personally think a spec clarification is required here, although like all clarifications it's not going to do any harm.

Yes, a clarification in the spec is (probably) not formally needed. But there's also an ambiguity where Adobe Technical Note #5014, "Adobe CMap and CIDFont Files Specification" call these postscript CID keyed fonts CIDFonts, and CIDFonts as intended by the PDF specification (which are basically the descendants of composite Type 0 fonts). So, while the specification formally prohibits them, we don't know for sure if Adobe products may still implicitly support them in PDF, because of sharing of some common code for font handling. After all, they look like they can be safely converted to CFF with CID indexing information. I have actually tried with afdko tx tool and it seems to work.

ceztko added a commit to podofo/podofo that referenced this issue Dec 7, 2024
Discussion opened at pdf-issues if they should be supported or not by PDF.
So far found only CJK fonts like those, so we set them unsupported for now.
pdf-association/pdf-issues#497
@ceztko
Copy link
Author

ceztko commented Dec 29, 2024

For my own curiosity, I fabricated some test files embedding these Type 1 CIDFont(s) and...Adobe Acrobat Viewer is able to view them! This doesn't prove anything other than the fact Adobe products performs some normalization steps to font programs and that they include routines to open such format. It's also weird that I had to use them in a CIDFontType2 with a FontFile2 entry (a quick test with CIDFontType0 with FontFile3 wasn't working).

Here it follows the fabricated test PDFs. They all show a different font, even if it is named /WadaMin-Regular in the PDF in all cases (this should prove the embedded font program is actually used).

WadaMin-Regular-NoEmbed.pdf
WadaMin-Regular.pdf
WadaMin-Bold.pdf
WadaMaruGo-Regular.pdf
WadaGo-Bold.pdf

As reported earlier I found such fonts here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants