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

Handle tfm files which do not contain coding information #12

Merged
merged 3 commits into from
Nov 1, 2019

Conversation

juliangilbey
Copy link
Contributor

Hi Han-Wen!

It turns out that converting to Python 3 revealed an ancient issue: the code does not handle TFM files which do not have coding information in a particularly meaningful way, and that causes it to bomb out under Python 3 (see Debian bug#941885). In the Python 2 version, the coding string read from the file was meaningless binary, which didn't match any recognised coding system, but in Python 3, the encoding of the string needs to be specified, and so it breaks.

This patch handles this by only reading the coding string if the header is more than 2 words long.

Best wishes,

Julian

@hanwen
Copy link
Owner

hanwen commented Oct 22, 2019

can you provide more detail? Which tfm files lack coding?

Is there a way you can do a test run from the make file on one of these files so this new code gets exercised?

@juliangilbey
Copy link
Contributor Author

Hi Han-Wen,

If you run (as the Debian bug reporter did) "mftrace lhr10", the current version bombs out, but it works with the patched version.

Best wishes,

Julian

@juliangilbey
Copy link
Contributor Author

Adding cmr11 to the TEST_FONTS line in the makefile does the job; added this to the patch.
Also, in my experiments, I discovered that mftrace crashes if you ask it to convert more than one font at once, because it changes directory out of the temp_dir at the end of do_file, but doesn't change back again on the next do_file run; I've fixed that too.

Best wishes,

Julian

@hanwen hanwen merged commit 3b4bc2e into hanwen:master Nov 1, 2019
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.

None yet

2 participants