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

Parsing VmtxTable fails for C:\Windows\Fonts\msyi.ttf #6

Closed
roy-t opened this issue Feb 15, 2023 · 6 comments
Closed

Parsing VmtxTable fails for C:\Windows\Fonts\msyi.ttf #6

roy-t opened this issue Feb 15, 2023 · 6 comments

Comments

@roy-t
Copy link
Owner

roy-t commented Feb 15, 2023

@wldevries the new addition for the VmtxTable seems to have a bug, with the msyi.ttf font it fails because it tries to read past the end of the stream.

Can you try to run WindowsFontsTest.ShouldParseWindowsFonts and try to debug the issue? Unfortunately I'm not familiar with the VmtxTable, but for you its fresh in your head 😄 .

@roy-t
Copy link
Owner Author

roy-t commented Feb 15, 2023

It looks like it also happens in C:\Windows\Fonts\simsunb.ttf, all other fonts I have installed seem fine. Both are Chinese fonts so maybe its an issue with top->bottom fonts?.

Note that I've just pushed a new version to master, that highlights this issue better.

@wldevries
Copy link
Contributor

After adding sanity checks that compares the expected table length and the actual table length there are problems in a lot of fonts. A similar issue occurs in the HmtxTable table.

I suspect the counters are maybe wrong: VheaTable.NumberOfVMetrics, HheaTable.NumberOfHMetrics and MaxpTable.NumGlyphs. At the moment I'm a bit at a loss though. They seem to be read at the correct table offset and in the correct format. Will investigate more later.

@wldevries
Copy link
Contributor

I found the problem: I used the FontReader.Seek method which seeks from the beginning of the file to skip over reserved space.

https://github.com/roy-t/TrueType/blob/master/RoyT.TrueType/Tables/HheaTable.cs#L28

@roy-t
Copy link
Owner Author

roy-t commented Feb 15, 2023

Ah yes it uses this.BaseStream.Seek(offset, SeekOrigin.Begin); feel free to add an overload to FontReader.Seek that does a relative seek :)

@wldevries
Copy link
Contributor

Can be closed now. Thanks for the support :-)

Also, readme still states netstandard 1.6 instead of 2.0

@roy-t
Copy link
Owner Author

roy-t commented Feb 24, 2023 via email

@roy-t roy-t closed this as completed May 7, 2023
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