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

difference between "Keep Glyphs" vs "Export Glyphs" custom params? #295

Open
anthrotype opened this issue Dec 6, 2017 · 11 comments
Open

Comments

@anthrotype
Copy link
Member

fontmake currently uses a combination of "com.schriftgestaltung.Glyphs.Export" (bool, inside the GLIF lib) and "com.schriftgestaltung.Keep Glyphs" (list of strings, in the global UFO lib) in order to determine the list of final glyphs to keep in the generated font (currently using the fonttools subsetter after the fact, but I'd like to change this, anyway that's another issue..).

https://github.com/googlei18n/fontmake/blob/6cdf44ea38d17f9bb14fa65c1c9bc6ea82e3b89b/Lib/fontmake/font_project.py#L300-L304

In the Glyphs handbook I see two very similar custom parameters and I can't understand what is the difference between the two.

Can anyone please enlighten me? Thanks

/cc @schriftgestalt @moyogo @belluzj

Keep Glyphs (list) List of glyphs that will be kept in the exported
  font. All other glyphs will be discarded, and kerning and
  automatic feature code will be updated accordingly. Works as
  the opposite of the Remove Glyphs parameter, useful for
  webfont subsetting in order to achieve smaller file sizes.
  Remove Glyphs and Keep Glyphs are mutually exclusive.

Export Glyphs (list) Exports all glyphs listed, regardless of whether
  the glyph was set to export or not.
@anthrotype
Copy link
Member Author

is the key difference that "regardless of whether the glyph was set to export or not"? because by just reading the description of "Keep Glyphs" it's definitely not clear the connection with the glyph "export" flag...

@anthrotype
Copy link
Member Author

and do we need to support that "Export Glyphs" somehow?

(I wonder why one needs three ways to specify a font's subset)

@schriftgestalt
Copy link
Collaborator

The .exports key is ignored when the glyph is mentioned in a ‘Keep Glyphs’ parameter.

@anthrotype
Copy link
Member Author

wait.. you actually mean the .exports key is ignored when the glyph is mentioned in Export Glyphs?
that's what I understand from "regardless of whether the glyph was set to export or not"... 😕

@schriftgestalt
Copy link
Collaborator

I just had another look. There are two different parameters.

  • Keep Glyphs: only glyphs mentioned are exported. All other are not.
  • Export Glyphs: the glyphs in this list will be set to export. No influence on the other glyphs

@anthrotype
Copy link
Member Author

great, so the thing fontmake is currently doing is wrong.. because it checks Keep Glyphs and if it's not in there it checks the individual exports flags.

so this Export Glyphs is kind of a global override which (for a given font instance) discards the individual glyph exports flags, and makes it so that the glyphs included are exported, but those that aren't will be exported depending on their individual export flag (which is basically fontmake's current algorithm).

hm, I'm not sure what to do.

@schriftgestalt
Copy link
Collaborator

I think you are doing it right. The Keep Glyphs parameter is optional, and if not there, the export setting per glyph is respected.

There is one more parameter in that group: Remove Glyphs. That is doing the opposite of Export Glyphs by disabling the .export setting of the mentioned glyphs.

@anthrotype
Copy link
Member Author

I think you are doing it right.

No, this is what fontmake is doing: it first checks if the keep_glyphs list is not empty; then it checks if the glyph name is present in there; if not, it skips the glyph and continues the loop; (so far so good). However, if the keep_glyphs list is either missing or is empty, or it is non-empty and the glyph name is contained in there, fontmake goes on checking the individual glyph exports flag: if the latter is present and set to False, fontmake skips the glyph, despite the global keep_glyphs list said the contrary.

this is the code:

https://github.com/googlei18n/fontmake/blob/6cdf44ea38d17f9bb14fa65c1c9bc6ea82e3b89b/Lib/fontmake/font_project.py#L326-L329

@schriftgestalt
Copy link
Collaborator

I do is

@madig
Copy link
Collaborator

madig commented Jun 14, 2018

So, "Keep Glyphs" overrides everything, then the export flag on a glyph is honored except if the glyph name is in "Export Glyphs" or not honored if it is in "Remove Glyphs"?

@anthrotype
Copy link
Member Author

I don't think we need to support all four ways to subset glyphs. It's already complicated like this, with global "Keep Glyphs" and per-glyph "Export" flags. Let's keep it simple

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

3 participants