8000 [ttLib] allow the glyf table to be incomplete when dumping to XML by justvanrossum · Pull Request #1681 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

[ttLib] allow the glyf table to be incomplete when dumping to XML #1681

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

Merged

Conversation

justvanrossum
Copy link
Collaborator
@justvanrossum justvanrossum commented Aug 3, 2019

Allow the glyf table to be incomplete — to not contain all glyphs listed in the glyph order — when writing to XML. Partially addresses #684.

… from the glyph order) when writing to XML. Partially addresses fonttools#684.
@justvanrossum justvanrossum changed the title [ttLib] allow the glyf table to be incomplete [ttLib] allow the glyf table to be incomplete when dumping to XML Aug 3, 2019
@anthrotype
Copy link
Member

hm.. instead of continue shouldn't you dump an empty TTGlyph element instead?

@anthrotype
Copy link
Member

what happens when loading fromXML where not all glyphs from GlyphOrder are actually present in the glyf table dump? You end up with an incomplete glyf table?
I think there is an implicit guarantee that the glyf table keys and ttFont.getGlyphOrder() be the same, at least after loading a font from file (whether binary or xml).
There's lots of code around that loops over for glyphName in ttFont.getGlyphOrder(): glyph = ttFont["glyf"][glyphName]

@anthrotype
Copy link
Member

oh I see now, you want to support #684...

@justvanrossum
Copy link
Collaborator Author

Well, to some extent. It allows the font from #684 to be dumped, but not recompiled. I'm not sure we need to support either, actually. I was just thinking it doesn't harm us if we allow an incomplete glyf table to be dumped, even if it's broken according to the spec.

@anthrotype
Copy link
Member

ok. how about at least logging a warning for the missing glyphs?

@justvanrossum
Copy link
Collaborator Author

how about at least logging a warning for the missing glyphs?

Good idea, done. Let me know if you want the warning to be worded differently.

Copy link
Member
@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording is ok

@@ -138,6 +138,10 @@ def toXML(self, writer, ttFont, splitGlyphs=False):
path, ext = os.path.splitext(writer.file.name)
existingGlyphFiles = set()
for glyphName in glyphNames:
if glyphName not in self:
log.warning("glyph '%s' does not exist in glyf table", glyphName)
log.warning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a duplicate "log.warning"

@justvanrossum justvanrossum merged commit 0ea19f3 into fonttools:master Aug 15, 2019
@justvanrossum justvanrossum deleted the allow_empty_glyph_dump_issue684 branch August 15, 2019 16:46
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

Successfully merging this pull request may close these issues.

2 participants
0