8000 TTX - Certain fonts will produce an error with merge. · Issue #3699 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TTX - Certain fonts will produce an error with merge. #3699

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

Open
Davexx opened this issue Nov 24, 2024 · 2 comments
Open

TTX - Certain fonts will produce an error with merge. #3699

Davexx opened this issue Nov 24, 2024 · 2 comments

Comments

@Davexx
Copy link
Davexx commented Nov 24, 2024

Hi, I was testing TTX out.
here were a few fonts that were giving errors.
1.) I used TTX -t name to pull the name table out of the font, then, without altering the .ttx file,
2.) I immediately use TTX -m to merge the .ttf or .otf/.ttf file together.

I get the following error:

Compiling "giotto.ttx" to "giotto#1.ttf"... Parsing 'name' table... ERROR: Unhandled exception has occurred Traceback (most recent call last): File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\ttx.py", line 452, in main process(jobs, options) ~~~~~~~^^^^^^^^^^^^^^^ File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\ttx.py", line 434, in process action(input, output, options) ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\misc\loggingTools.py", line 375, in wrapper return func(*args, **kwds) File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\ttx.py", line 327, in ttCompile ttf.importXML(input) ~~~~~~~~~~~~~^^^^^^^ File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\ttLib\ttFont.py", line 404, in importXML reader.read() ~~~~~~~~~~~^^ File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\misc\xmlReader.py", line 52, in read self._parseFile(self.file) ~~~~~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\Davexx\AppData\Local\Programs\Python\Python313\Lib\site-packages\fontTools\misc\xmlReader.py", line 78, in _parseFile parser.Parse(chunk, 0) ~~~~~~~~~~~~^^^^^^^^^^ xml.parsers.expat.ExpatError: not well-formed (invalid token): line 6, column 6

Here are some example fonts to try where the TTX merge is not working:
https://fontmeme.com/fonts/opti-giotto-font/
https://fontmeme.com/fonts/american-gothic-font/

@justvanrossum
Copy link
Collaborator

I can reproduce be round-tripping the opti giotto font, but not with any of the american gothic fonts.

It seems some name strings contain null bytes, which causes ttx to output invalid XML.

@Davexx
Copy link
Author
Davexx commented Nov 24, 2024
58EF

Apologies for sending the incorrect link to American Gothic fonts. Those ones do indeed work. Let me know if you need me to send other examples.
I found the name strings that contained what you said were the null byte.
EASY FIX:
1.) Use Notepad++ and use Encoding > Convert to UTF-8.
It will convert the null byte and reveal a long sting of space characters in of one of the strings.
2.) I deleted the extra spaces...
3.) Save the .ttx
4.)use ttx -m to merge the font file with the .ttx file and no more errors!

Thank you for the quick fix!

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
0