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

ssXX descriptive names are restricted to ASCII #34

Closed
adrientetar opened this issue Feb 9, 2015 · 11 comments
Closed

ssXX descriptive names are restricted to ASCII #34

adrientetar opened this issue Feb 9, 2015 · 11 comments

Comments

@adrientetar
Copy link
Contributor

feature ss01 {
    featureNames {
        name "®";
    };
   [...]
} ss01;

yields:

makeotfexe [FATAL] <PSFont-Regular> invalid token (text was "�") [../family.fea 219]

@readroberts: Hopefully this is not by-design?

@kenlunde
Copy link

kenlunde commented Feb 9, 2015

Try using the following (a backslash followed by four hexadecimal digits that correspond to the Unicode scalar value of the character U+00AE):

feature ss01 {
    featureNames {
        name "\00AE";
    };
   [...]
} ss01;

@pauldhunt
Copy link

I was under the impression that these names can only contain ASCII characters.

@readroberts
Copy link
Contributor

The stylistic names may be any encoding supported by the name table, which goes way beyond ASCII. See:
http://www.microsoft.com/typography/otspec/features_pt.htm#ssxx

The feature file supports only ASCII entry for name string values. Non-ascii characters must be represented by the character code in hexadecimal. See the feature file spec section '9.e name table'. This is because name table strings may be specified in many different encodings, and it is not necessarily possible to convert from a given text encoding in the feature file to the desired name string encoding. The simplest approach is to support only the most basic text encoding, and make the user responsible for anything more complex.

@adrientetar
Copy link
Contributor Author

Well that was fast! thank you all for responding.

@adrientetar
Copy link
Contributor Author

I have tried to escape the characters as shown below:

        featureNames {
            name "Superscript \00AE"; # Windows English
            name 1 0 0 "Superscript \00AE"; # Mac English
            name 3 1 0x040c "\00AE \00E0 l\2019exposant"; # Windows French
            name 1 0 1 "\00AE \00E0 l\2019exposant"; # Mac French
        };

This yields a "Bad string" error tho. Any idea?

@adrientetar adrientetar reopened this Feb 9, 2015
@adrientetar
Copy link
Contributor Author

Note that similar strings without escapes return no error.

@kenlunde
Copy link

kenlunde commented Feb 9, 2015

My guess is that the first and third "name" strings are okay, because they refer to Unicode strings. Please try with only those lines. The second and fourth lines are referencing non-Unicode encodings, which are byte-based. You'll need to specify only two hexadecimal digits after the backslash, for the characters that correspond to U+00AE, U+00E0, and U+2019.

@readroberts
Copy link
Contributor

The problem is that the two name strings for the Mac platform are using 4 digit hex values. For the Mac platform, Roman script, the encoding values are 1 byte values, and must be represented as 2 digit hexadecimal values, e.g "\AE" rather than "\00AE". If you take out the leasing zeroes for those two strings, I think it will work.

@kenlunde
Copy link

kenlunde commented Feb 9, 2015

The Macintosh Roman equivalents of U+00AE, U+00E0, and U+2019 are 0xA8, ("\A8"), 0x88 ("\88"), and 0xD5 ("\D5"). Wikipedia's Mac OS Roman page may be helpful.

@adrientetar
Copy link
Contributor Author

It works and passes makeotf, thanks Ken, Read. Cheers.

@kenlunde
Copy link

kenlunde commented Feb 9, 2015

Our pleasure. ☺

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

4 participants