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

[makeotf] relaxed charset requirements in feature files lead to worries in CFF TopDict #1767

Open
frankrolf opened this issue Dec 3, 2024 · 3 comments

Comments

@frankrolf
Copy link
Member

The makeotf process uses .fea files for a lot of purposes, including name table overrides. For a while now (since #1133), UTF-8 has been accepted in those files – which is great!

Here is one such override (from https://github.com/adobe-fonts/source-serif/blob/main/familynameIDs.fea):

nameid 9 "Frank Grießhammer";

In the dark past, this would have been

nameid 9 "Frank Grie\00dfhammer";

This is all great, and produces .fea files of superior readability.
However, there’s one problem – the copyright string (nameID 0):

currently

nameid 0 "© 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’.";

previously

nameid 0 "\00a9 2014 - 2021 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name \2018Source\2019.";

The issue:
The following CFF TopDict strings are not in the ASCII range: - Copyright: © 2023 Adobe. All rights reserved, with Reserved Font Name 'Source'. [code: cff-string-not-in-ascii-range] (adobe-fonts/source-code-pro#339)

It seems that makeotf writes the nameID 0 string into the CFF TopDict as-is. The CFF TopDict only accepts ASCII.
The solution is to go back to escaped notation – I wonder if this could happen behind the scenes, rather than forcing the user to remember doing this for a single override?

@frankrolf
Copy link
Member Author

Okay, I might have mis-interpreted things. The CFF TopDict is not fed by the name table overrides.

The copyright string seems to come directly from the UFO file. When the UFO does not contain a copyright string, there won’t be anything in the TopDict, either.

This is the result of my testing (escaped on the left, UTF-8 on the right):
image

@frankrolf
Copy link
Member Author

reopening after further discussion.

@frankrolf frankrolf reopened this Dec 4, 2024
@skef
Copy link
Collaborator

skef commented Dec 5, 2024

Given the symptoms, the likely cause of this problem is TX adding the string (probably as a Notice) to the Type1 generated from the UFO, which is then imported by makeotfexe to convert to a CFF2.

The new code (in the addfeatures branch) doesn't work this way. It uses tx to generate a CFF directly from the UFO. So the place to fix this going forward is likely in that path. An easy fix would be to test if the UFO string has non-ASCII characters and not include the string in that case (also issuing a warning).

The question with Type 1 would then be less urgent given that the Type 1 format is officially retired, but perhaps we could do the same thing in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants