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

fontmake fails to remove hyphens in names from glyphs source #455

Closed
mjlagattuta opened this issue Aug 7, 2018 · 9 comments
Closed

fontmake fails to remove hyphens in names from glyphs source #455

mjlagattuta opened this issue Aug 7, 2018 · 9 comments

Comments

@mjlagattuta
Copy link

Glyphs App employs hyphens in glyph names do detail the script a glyph belongs to. This is normally not an issue for fontmake as those glyph names are converted to production names on export. The issue is that if a name is used which has no production equivalent then the hyphens are not removed.

In my case I was using "descender-cy" to make Cyrillic composites. I believe the practice in Glyphs is to drop the hyphen on export and I was wondering if fontmake could do the same

@davelab6
Copy link
Member

davelab6 commented Aug 7, 2018

Context: https://forum.glyphsapp.com/t/do-all-glyphs-drop-their-hyphens-on-export/9519/3 & googlefonts/robotoslab#10

Seems high priority and perhaps relatively simple to fix :)

@anthrotype
Copy link
Member

For reference, i'm quoting below the latest version of Adobe Feature File spec as available on the github afdko repository (the one published on Adobe's website is not up to date apparently)

Source: https://github.com/adobe-type-tools/afdko/blob/develop/docs/OpenTypeFeatureFileSpecification.html

======

2.f.i. Glyph name

There are two different contexts for glyph naming: final production names and development names.

For production glyph names, names that are used in shipping font files, the specification is set by the Postscript and Type 1 specifications, which define what is expected by existing PostScript interpreters. These limitations are as follows.

A glyph name may be up to 63 characters in length, must be entirely comprised of characters from the following set:

A-Z a-z 0-9 . (period) _ (underscore)

and must not start with a digit or period. The only exception is the special character ".notdef".

"twocents", "a1", and "_" are valid glyph names. "2cents" and ".twocents" are not.

Development glyph names, names used in source data during the development of a font, have a larger supported character set. In addition to the characters allowed for production glyph names, the following characters must also be supported for development glyph names:

  • U+002A * Asterisk
  • U+002B + Plus sign
  • U+002D - Hyphen-minus
  • U+003A : Colon
  • U+005E ^ Circumflex accent
  • U+007C | Vertical bar
  • U+007E ~ Tilde

@anthrotype
Copy link
Member

I think it should be the responsibility of ufo2ft PostProcessor to perform this, since it is already doing the renaming from development to production glyph names.
I think we just need to replace any characters that are not in the valid set with an underscore.
The valid characters according to the quote above are: A-Z a-z 0-9 . (period) _ (underscore)

@anthrotype
Copy link
Member

and if they start with a digit or period, we prefix them with another underscore

@moyogo
Copy link
Collaborator

moyogo commented Aug 7, 2018

The OT spec for the post table points to the AGL specification which says the same: A-Z a-z 0-9 . (period) _ (underscore).

@madig
Copy link
Collaborator

madig commented Aug 10, 2018

makeotf/Glyphs really just drops the hyphen it seems (minus: Glyphs, plus: fontmake):

-    <GlyphID id="1065" name="brevecombcy"/>
-    <GlyphID id="1066" name="descendercy"/>
-    <GlyphID id="1067" name="brevecombcy.case"/>
-    <GlyphID id="1068" name="descendercy.case"/>
-    <GlyphID id="1069" name="descendercy.strait"/>
+    <GlyphID id="1065" name="brevecomb-cy"/>
+    <GlyphID id="1066" name="descender-cy"/>
+    <GlyphID id="1067" name="brevecomb-cy.case"/>
+    <GlyphID id="1068" name="descender-cy.case"/>
+    <GlyphID id="1069" name="descender-cy.strait"/>

@anthrotype
Copy link
Member

anthrotype commented Aug 10, 2018

dropping invalid chars is fine. If we like we can handle potentially clashing names by appending a suffix with a digit, but anyway those glyph names that don’t get a proper uniXXXX or AGL standard name are junk so it’s not too bad if such clashes occur in practice

@madig
Copy link
Collaborator

madig commented Aug 10, 2018

If they are junk, why are we writing them to the post table anyway?

@anthrotype
Copy link
Member

fixed in googlefonts/ufo2ft#274

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

5 participants